I think people have been clamoring for an INumeric<T> for a long time now actually, there's even been high-level discussion.
I'd like to add, when you define a "static readonly" variable in a class, that should go into another heap that doesn't get scanned during a GC.
I definitely think the .NET Framework should support a wider variety of intrinsics for things like this.
"const" already means "compile time", so my vote would be with "readonly". This feature would keep you in good behavior while writing the rest of the method in question. I would say we should also allow "readonly" with method parameters, which are after all on the same stack as local variables.
readonly int customer = customers.First();
This is a no-brainer, I don't know why it doesn't get top votes considering how simple it is. Yes you can pass in a delegate as a generic parameter but it has to have a "class" constraint. And you can pass in an enum but it has to have a "struct" constraint. Inside the generic method though, there is no strong-typing against the delegate or the enum. There's no explainable reason for this.
I have a simple class that implements INotifyPropertyChanged, caches PropertyChangedEventArgs instances, and exposes PropertyChanged that you want to use the += operator on. I want to be able to tack this onto any other class. Without multiple inheritance I have to duplicate this functionality every single time and maintain it separately every single spot.
People who are against multiple inheritance tend to be simple programmers. Bleeding edge requires more.
You can thank me later.
public static bool InRange<T>(this T value, T lower, T upper) where T : IComparable<T>
return (value.CompareTo(lower) >= 0) && (value.CompareTo(upper) <= 0);