The document summarizes features in C# 10 and beyond, including records, required properties, parameter null checking, pattern matching, lambda improvements, and value tuple deconstruction. It also discusses how to run samples and provides information about the presenter, Moaid Hathot. Key C# 10 features covered are records, properties, parameter null checking, pattern matching, and lambda improvements. The document promotes less code through features like file-scoped namespaces and global using directives. It concludes with a discussion of abstract data types and static abstract members in interfaces.
What do you mean, Backwards Compatibility?Trisha Gee
Lessons learnt developing the new Java driver for MongoDB. This is a totally different version of my backwards compatibility talk, delivered at JFokus.
Video: https://www.youtube.com/watch?v=SfrEThI_m7g
Source code: https://github.com/Alotor/2015-greach-groovy-dsls
Behind each good Groovy library or framework there is a good DSL (Domain Specific Language). And this is not by chance, one of the most exciting features of Groovy is its amazing syntax flexibility and metaprogramming capabilities that allow us do things in a highly expressive manner through DSLs.
In this talk I’ll explain the basics of doing DLS’s with Groovy. What you’ll need to start and what to investigate deeper. Also, we’ll check some of the most well known ones libraries like Spock, Gradle or Grails so you can use their techniques in your own Groovy projects.
What do you mean, Backwards Compatibility?Trisha Gee
Lessons learnt developing the new Java driver for MongoDB. This is a totally different version of my backwards compatibility talk, delivered at JFokus.
Video: https://www.youtube.com/watch?v=SfrEThI_m7g
Source code: https://github.com/Alotor/2015-greach-groovy-dsls
Behind each good Groovy library or framework there is a good DSL (Domain Specific Language). And this is not by chance, one of the most exciting features of Groovy is its amazing syntax flexibility and metaprogramming capabilities that allow us do things in a highly expressive manner through DSLs.
In this talk I’ll explain the basics of doing DLS’s with Groovy. What you’ll need to start and what to investigate deeper. Also, we’ll check some of the most well known ones libraries like Spock, Gradle or Grails so you can use their techniques in your own Groovy projects.
C# 7.x What's new and what's coming with C# 8Christian Nagel
C# is extended in a fast pace – with new features allow to reduce the code you need to write, offer more safety, and gives better performance – and you still write safe code. In this session you are introduced to the new C# 7.0-7.3 features including tuples and pattern matching, and learn about the features planned with C# 8.0 such as nullable reference types, extensions for pattern matching, and the new switch expression.
This presentation helps discover some of the specific features of Java 8, (in particular, atomics and parallelism) and start using them effectively.
This presentation by Maksym Voronyi (Software Engineer, GlobalLogic) was delivered at Java.io 3.0 conference in Kharkiv on March 24, 2016, and GlobalLogic Mykolaiv Java Conference on June 11, 2016.
This presentation deals with RealmDB, which is a convenient replacement for SQLite & Core Data in mobile development.
Presentation by Anton Minashkin (Software Engineer, GlobalLogic, Lviv), delivered at Mobile TechTalk Lviv on April 28, 2015.
More details - http://globallogic.com.ua/mobile-techtalk-lviv-2015-report
Large scale nlp using python's nltk on azurecloudbeatsch
This presentation provides an introduction to natural language processing (nlp) using python's natural language toolkit (nltk). Furthermore it describes how to run python (and more specifically nltk) as an elastic webjob on Azure.
The presentation describes how to install the NLTK and work out the basics of text processing with it. The slides were meant for supporting the talk and may not be containing much details.Many of the examples given in the slides are from the NLTK book (http://www.amazon.com/Natural-Language-Processing-Python-Steven/dp/0596516495/ref=sr_1_1?ie=UTF8&s=books&qid=1282107366&sr=8-1-spell ).
This was a presentation I gave at the 17th Tcl Conference, in Oakbrook Terrace, IL, in 2010. It describes some of the more sophisticated things that it is possible to do with the new Tcl object system, TclOO.
Basic NLP concepts and ideas using Python and NLTK framework. Explore NLP prosessing features, compute PMI, see how Python/Nltk can simplify your NLP related task.
This presentation is from the 22nd Tcl Conference (Manassas, VA, 21-23 October 2015). It's where I describe where we've got up to with compiling Tcl to native machine code.
In recent years we have seen explosion of languages which run on Java Virtual Machine. We also have seen existing languages getting their implementations being rewritten to JVM. With all of the above we have seen rapid development of tools like parsers, bytecode generators and such, even inside JVM we saw initiatives like Da Vinci Machine Project, which led to invoke dynamic in JDK 7 and recent development of Graal and Truffle projects.
Is it really hard to write new programming language running on JVM? Even if you are not going to write your own I think it is worth to understand how your favorite language runs undercover, how early decisions can impact language extensibility and performance, what JVM itself and JVM ecosystem has to offer to language implementors.
During the session I will try to get you familiar with options you have when choosing parsers and byte code manipulation libraries. which language implementation to consider, how to test and tune your "new baby". Will you be able after this session to develop new and shiny language, packed with killer features language? No. But for sure you will understand difference between lexers and parsers, how bytecode works, why invoke dynamic and Graal and Truffle are so important to the future of JVM platform. Will we have time to write simple, compiled language?
2017 02-07 - elastic & spark. building a search geo locatorAlberto Paro
Presentazione dell'evento EsInRome del 7 Febbraio 2017 - Integrazione Elasticsearch in architettura BigData e facilità di integrazione con Apache Spark.
2017 02-07 - elastic & spark. building a search geo locatorAlberto Paro
Using Elasticsearch in a BigData environment is very simple. In this talk, we analyse what's Big Data and we show how it is easy integrating ElasticSearch with Apache Spark
C# 7.x What's new and what's coming with C# 8Christian Nagel
C# is extended in a fast pace – with new features allow to reduce the code you need to write, offer more safety, and gives better performance – and you still write safe code. In this session you are introduced to the new C# 7.0-7.3 features including tuples and pattern matching, and learn about the features planned with C# 8.0 such as nullable reference types, extensions for pattern matching, and the new switch expression.
This presentation helps discover some of the specific features of Java 8, (in particular, atomics and parallelism) and start using them effectively.
This presentation by Maksym Voronyi (Software Engineer, GlobalLogic) was delivered at Java.io 3.0 conference in Kharkiv on March 24, 2016, and GlobalLogic Mykolaiv Java Conference on June 11, 2016.
This presentation deals with RealmDB, which is a convenient replacement for SQLite & Core Data in mobile development.
Presentation by Anton Minashkin (Software Engineer, GlobalLogic, Lviv), delivered at Mobile TechTalk Lviv on April 28, 2015.
More details - http://globallogic.com.ua/mobile-techtalk-lviv-2015-report
Large scale nlp using python's nltk on azurecloudbeatsch
This presentation provides an introduction to natural language processing (nlp) using python's natural language toolkit (nltk). Furthermore it describes how to run python (and more specifically nltk) as an elastic webjob on Azure.
The presentation describes how to install the NLTK and work out the basics of text processing with it. The slides were meant for supporting the talk and may not be containing much details.Many of the examples given in the slides are from the NLTK book (http://www.amazon.com/Natural-Language-Processing-Python-Steven/dp/0596516495/ref=sr_1_1?ie=UTF8&s=books&qid=1282107366&sr=8-1-spell ).
This was a presentation I gave at the 17th Tcl Conference, in Oakbrook Terrace, IL, in 2010. It describes some of the more sophisticated things that it is possible to do with the new Tcl object system, TclOO.
Basic NLP concepts and ideas using Python and NLTK framework. Explore NLP prosessing features, compute PMI, see how Python/Nltk can simplify your NLP related task.
This presentation is from the 22nd Tcl Conference (Manassas, VA, 21-23 October 2015). It's where I describe where we've got up to with compiling Tcl to native machine code.
In recent years we have seen explosion of languages which run on Java Virtual Machine. We also have seen existing languages getting their implementations being rewritten to JVM. With all of the above we have seen rapid development of tools like parsers, bytecode generators and such, even inside JVM we saw initiatives like Da Vinci Machine Project, which led to invoke dynamic in JDK 7 and recent development of Graal and Truffle projects.
Is it really hard to write new programming language running on JVM? Even if you are not going to write your own I think it is worth to understand how your favorite language runs undercover, how early decisions can impact language extensibility and performance, what JVM itself and JVM ecosystem has to offer to language implementors.
During the session I will try to get you familiar with options you have when choosing parsers and byte code manipulation libraries. which language implementation to consider, how to test and tune your "new baby". Will you be able after this session to develop new and shiny language, packed with killer features language? No. But for sure you will understand difference between lexers and parsers, how bytecode works, why invoke dynamic and Graal and Truffle are so important to the future of JVM platform. Will we have time to write simple, compiled language?
2017 02-07 - elastic & spark. building a search geo locatorAlberto Paro
Presentazione dell'evento EsInRome del 7 Febbraio 2017 - Integrazione Elasticsearch in architettura BigData e facilità di integrazione con Apache Spark.
2017 02-07 - elastic & spark. building a search geo locatorAlberto Paro
Using Elasticsearch in a BigData environment is very simple. In this talk, we analyse what's Big Data and we show how it is easy integrating ElasticSearch with Apache Spark
Webinar: Simplifying Persistence for Java and MongoDBMongoDB
Jeff Yemin will host a webinar covering the design and major features of Morphia, an Object Document Mapper (ODM) for Java and MongoDB. This webinar will start with a short introduction to MongoDB and the various options for building MongoDB applications on the JVM before taking a deep dive into Morphia. Morphia will be presented as an extended example format that demonstrates, for each feature, the domain model, a test driver, and the results as they appear in MongoDB.
Building a friendly .NET SDK to connect to SpaceMaarten Balliauw
Space is a team tool that integrates chats, meetings, git hosting, automation, and more. It has an HTTP API to integrate third party apps and workflows, but it's massive! And slightly opinionated.
In this session, we will see how we built the .NET SDK for Space, and how we make that massive API more digestible. We will see how we used code generation, and incrementally made the API feel more like a real .NET SDK.
Slides for the "What's Coming in C# 9.0" session that is part of .NET Conf Israel 2020.
Github repo:
https://github.com/MoaidHathot/dotnet-conf-israel-2020-whats-coming-to-CSharp9
Slides for the "What's Coming in C# 9.0" session that is part of MVP Days Israel 2020 conf.
Github repo:
https://github.com/MoaidHathot/mvp-days-israel-2020-whats-coming-to-CSharp9
Distributed Application Runtime (Dapr) - Azure Israel 2020Moaid Hathot
The slides for the session about Distributed Application Runtime (Dapr) in the Azure-Israel meetup, 07, September 2020.
https://www.meetup.com/AzureIsrael/events/272049090/
The slides for my session about Dapr the Distributed Application Runtime in the Code.Digest("Microservices"); meetup.
https://www.meetup.com/Code-Digest/events/271747418/
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Best of build 2021 - C# 10 & .NET 6
1. Best of //Build 2021
C# 10, .NET 6 & Beyond
Moaid Hathot
Senior Software Engineer @ Microsoft | ex-Azure MVP
Moaid.Hathot@outlook.com
@MoaidHathot
https://moaid.codes
https://meetup.com/Code-Digest
2. Some features are still under development
Feature, design, and status
C# 10 features
3. Records
Record structs
Sealed ToString
Properties & Parameters improvements
Required Properties
‘field’ keyword
Parameter null-checking
Pattern matching
List Patterns
Extended Property Patterns
Cleaner code
File-scoped namespaces
File-scoped namespaces
Global using directives
Lambdas improvements
ValueTuple deconstruction
Deconstruction of ‘default’ literal
Mix declaration and variables in deconstruction
ADT – Abstract Data types
C# 10 and beyond
4. How to run the samples
.NET 6 SDK Preview 5
Visual Studio 2022 Preview + Roslyn feature branches
LinqPad 6 beta (not all features)
SharpLab.io
C# 10 and beyond
5. About Moaid Hathot
Senior software Engineer @ Microsoft
Ex-Azure MVP
Software Craftsmanship advocate
Clean Coder
Co-Founder of Code.Digest();
https://meetup.com/Code-Digest
Moaid Hathot
12. Records
public record Person(string FirstName, string LastName);
var moaid = new Person("Moaid", "Hathot");
var wifu = moaid with { FirstName = "Haneeni" };
var clone = moaid with { };
15. Records
public record Person(string FirstName, string LastName);
public record struct Person(string FirstName, string LastName);
public record class Person(string FirstName, string LastName);
19. Required Properties
public class Person
{ … }
var moaid = new Person("Moaid", "Hathot");
var moaid = new Person
{
FirstName = "Moaid",
LastName = "Hathot"
}
20. Required Properties
public class Person
{
public string FirstName { get; }
public string LastName { get; }
public Person(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
}
var moaid = new Person("Moaid", "Hathot");
21. Required Properties
public class Person
{
public string FirstName { get; }
public string LastName { get; }
public Person(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
}
var moaid = new Person("Moaid", "Hathot");
var moaid = new Person
{
FirstName = "Moaid",
LastName = "Hathot"
}
22. Required Properties
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public Person(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
public Person()
{
}
}
23. Required Properties
public class Person
{
public string FirstName { get; init; }
public string LastName { get; init; }
public Person(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
public Person()
{
}
}
24. Required Properties
public class Person
{
public string FirstName { get; init; }
public string LastName { get; init; }
public Person(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
public Person()
{
}
}
var moaid = new Person();
25. Required Properties
public class Person
{
public required string FirstName { get; init; }
public required string LastName { get; init; }
public Person(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
public Person()
{
}
}
26. Required Properties
public class Person
{
public required string FirstName { get; init; }
public required string LastName { get; init; }
}
var moaid = new Person
{
FirstName = "Moaid",
LastName = "Hathot"
}
44. List Patterns
var arr = new []{ 1, 2, 3 };
switch(arr)
{
case [_, 1, ..]: { }
case [.., 1, _]: { }
}
45. List Patterns
var arr = new []{ 1, 2, 3 };
switch(arr)
{
case [_, 1, ..]: { } // expr.Length is >= 2 && expr[1] is 1
case [.., 1, _]: { } // expr.Length is >= 2 && expr[^2] is 1
}
49. List Patterns
var arr = new []{ 1, 2, 3 };
arr is [1, 2, 3]
expr.Length is >= 2
&& expr[0] is 1
&& expr[1..^1] is var s
&& expr[^1] is 3
50. List Patterns
var arr = new []{ 1, 2, 3 };
arr is [1, 2, 3]
expr.Length is >= 2
&& expr[0] is 1 //expr[new Index(1, true)]
&& expr[1..^1] is var s //expr[new Range(1, new Index(1, true))]
&& expr[^1] is 3 //expr[new Index(1, true)]
59. Global using Directive
using System;
namespace BestOfBuild
{
public class Program
{
public static void Main()
{
Console.WriteLine("Hello World!");
}
}
}
60. Global using Directive
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
61. Global using Directive
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Human = BestOfBuild.Person;
62. Global using Directive
global using System;
global using System.Linq;
global using System.Collections.Generic;
global using System.Threading;
global using System.Threading.Tasks;
global using Human = BestOfBuild.Person;
68. ASP.NET MapActions
[HttpGet("/")] Todo GetTodo() => new(Id: 0, Name: "Name");
app.MapAction((Func<Todo>)GetTodo);
[HttpPost("/")] Todo PostTodo([FromBody] Todo todo) => todo;
app.MapAction((Func<Todo, Todo>)PostTodo);
69. ASP.NET MapActions
[HttpGet("/")] Todo GetTodo() => new(Id: 0, Name: "Name");
app.MapAction(GetTodo);
[HttpPost("/")] Todo PostTodo([FromBody] Todo todo) => todo);
app.MapAction(PostTodo);
71. ASP.NET Minimal APIs
using System;
using Microsoft.AspNetcore.Builder;
record Person(string FirstName, string LastName);
var app = WebApplication.Create(args);
app.MapGet("/", () => new ("Moaid", "Hathot"));
await app.RunAsync();
72. ASP.NET Minimal APIs
using System;
using Microsoft.AspNetcore.Builder;
record Person(string FirstName, string LastName);
var app = WebApplication.Create(args);
app.MapGet("/", () => new Person("Moaid", "Hathot"));
await app.RunAsync();
73. ASP.NET Minimal APIs
using System;
using Microsoft.AspNetcore.Builder;
record Person(string FirstName, string LastName);
var app = WebApplication.Create(args);
app.MapGet("/", () => new Person("Moaid", "Hathot"));
await app.RunAsync();
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send({ firstName: "Moaid", lastName: "Hathot"});
});
app.listen(3000, () => {
console.log(`App is listening`);
})
74. ASP.NET Minimal APIs
using Microsoft.AspNetcore.Builder;
record Person(string FirstName, string LastName);
var app = WebApplication.Create(args);
app.MapGet("/", () => new Person("Moaid", "Hathot"));
await app.RunAsync();
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send({ firstName: "Moaid", lastName: "Hathot"});
});
app.listen(3000, () => {
console.log(`App is listening`);
})
75. ASP.NET Minimal APIs
using Microsoft.AspNetcore.Builder;
var app = WebApplication.Create(args);
app.MapGet("/", () => new Person("Moaid", "Hathot"));
await app.RunAsync();
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send({ firstName: "Moaid", lastName: "Hathot"});
});
app.listen(3000, () => {
console.log(`App is listening`);
})
91. Static abstract members in interfaces
interface IAddable<T> where T : IAddable<T>
{
static abstract T Zero { get; }
static abstract T operator +(T t1, T t2);
}
92. Static abstract members in interfaces
interface IAddable<T> where T : IAddable<T>
{
static abstract T Zero { get; }
static abstract T operator +(T t1, T t2);
}
struct Int32 : …, IAddable<Int32>
{
static Int32 I.operator +(Int32 x, Int32 y) => x + y;
public static int Zero => 0;
}
93. Static abstract members in interfaces
interface IAddable<T> where T : IAddable<T>
{
static abstract T Zero { get; }
static abstract T operator +(T t1, T t2);
}
struct Int32 : …, IAddable<Int32>
{
static Int32 I.operator +(Int32 x, Int32 y) => x + y;
public static int Zero => 0;
}
public static T AddAll<T>(T[] ts) where T : IAddable<T>
{
T result = T.Zero; // Call static operator
foreach (T t in ts)
{
result += t; // Use `+`
}
return result;
}
94. Best of //Build 2021
Questions?
Moaid Hathot
Senior Software Engineer @ Microsoft | ex-Azure MVP
Moaid.Hathot@outlook.com
@MoaidHathot
https://moaid.codes
https://meetup.com/Code-Digest