Session
Pattern-based C#: if it quacks like a duck…
C# is a strongly typed programming language, to communicate expectations in a statically verifiable fashion across the .NET ecosystem. For example features such as LINQ require the type-in-use to implement a certain interface (e.g., the generic IEnumerable interface). Well, there is the dynamic keyword, but this is used quite rarely because it circumvents the type safety and has a measurable performance impact.
However, there is a set of features that the compiler allows you to safely enable on types by satisfying a particular shape, rather than through inheritance and implementation.
Features like:
- use any type within foreach statements
- apply the await operator to any type
- tuple-like deconstruction of internal and external types
- implicit Index and Range support
- collection initializers and expressions for user-defined types
and more.
Join our live coding session for a deep dive into the patterns recognized by the Roslyn compiler to learn how to augment reusable types for most convenient and idiomatic consumption in libraries and applications alike.
If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck.
Stefan Pölz
Clean C# Coder – Test-driven .NET Developer
Vienna, Austria
Links
Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.
Jump to top