Page 172 - CSharp/C#
P. 172
Named argument specification must appear after all fixed arguments have been specified
Variance
Generic interfaces and delegates can have their type parameters marked as covariant or
contravariant using the out and in keywords respectively. These declarations are then respected
for type conversions, both implicit and explicit, and both compile time and run time.
For example, the existing interface IEnumerable<T> has been redefined as being covariant:
interface IEnumerable<out T>
{
IEnumerator<T> GetEnumerator();
}
The existing interface IComparer has been redefined as being contravariant:
public interface IComparer<in T>
{
int Compare(T x, T y);
}
Optional ref keyword when using COM
The ref keyword for callers of methods is now optional when calling into methods supplied by
COM interfaces. Given a COM method with the signature
void Increment(ref int x);
the invocation can now be written as either
Increment(0); // no need for "ref" or a place holder variable any more
Dynamic member lookup
A new pseudo-type dynamic is introduced into the C# type system. It is treated as System.Object, but
in addition, any member access (method call, field, property, or indexer access, or a delegate
invocation) or application of an operator on a value of such type is permitted without any type
checking, and its resolution is postponed until run-time. This is known as duck typing or late
https://riptutorial.com/ 118

