This is part 17 of my Exploring the .NET CoreFX Series.
Microsoft’s .NET Core team has posted a videotaped API review session where they show how they review API enhancement suggestions. I thought the video was quite educational.

This is part 16 of my Exploring the .NET CoreFX Series.
While .NET has historically been limited to Windows machines, Mono notwithstanding, the introduction of the cross-platform .NET Core runtime has introduced the possibility of running .NET Core applications on Unix machines. With this possibility, developers may have the need of writing platform-specific code.
One way to write platform-specific code is:
Define a conceptual base class which will have an identical name and methods across all platforms.

This is part 15 of my Exploring the .NET CoreFX Series.
While C# supports type inference for generic methods, it does not support type inference for constructors. In other words, while this code works:
public class FooFactory { public static Foo<T> Create<T>(T value) { return new Foo<T>(value); } } var myObj = FooFactory.Create(212); This code does not:
public class Foo<T> { private readonly T field; public Foo(T value) { field = value; } } var obj = new Foo(212); // DOES NOT WORK For more background on why this is, see this StackOverflow post.

This is part 14 of my Exploring the .NET CoreFX Series.
Back in 2013, Immo Landwerth and Andrew Arnott recorded a Going Deep video called Inside Immutable Collections which describes how and why System.Collections.Immutable is built the way it is. It’s great background material to understand System.Collections.Immutable.

This is part 12 of my Exploring the .NET CoreFX Series.
In C++, the inline keyword allows a developer to provide a hint to the compiler that a particular method should be inlined. C# has the identical ability but uses an attribute instead:
internal class SecurePooledObject<T> { ....[MethodImpl(MethodImplOptions.AggressiveInlining)] internal bool IsOwned<TCaller>(ref TCaller caller) where TCaller : struct, ISecurePooledObjectUser { return caller.PoolUserId == _owner; } } In System.Collections.Immutable, this attribute is used highly selectively – only once, in fact.

This is part 11 of my Exploring the .NET CoreFX Series.
In 2008, Microsoft Research published Code Contracts, which provide a language-agnostic way to express coding assumptions in .NET programs. The assumptions take the form of pre-conditions, post-conditions, and object invariants.
Here is a simple example of code which uses Code Contracts:
using System.Diagnostics.Contracts; public class StringUtils { internal static string Append(string s1, string s2) { Contract.Requires(s1 != null); Contract.