The .NET Compiler Platform ("Roslyn") provides open-source C# and Visual Basic compilers with rich code analysis APIs.
Again, nullable types:
Again, nullable types:
@CyrusNajmabadi
Please open a proposal
I was pretty sure there is one already
@CyrusNajmabadi
- 'why not' is not a reason
Nullable is a type. I expect to be able to use it in any Type context. But for some reason I can't
@CyrusNajmabadi
Again, I don't see the issue there. You are comparing different types.
If you mean the code snippet then its the type inferred by the compiler. It should be the same as the type of object unless it's upcasted to something, which is not the case
Foo<T>(T t);
then you certainly can call it with Foo<int?>
When nullable struct is passed everyplace in compile time thinks it's underlying type but in runtime it's actually nullable (GetType() != typeof(T))
int i1 = 1;
int? i2 = 1;
object oi1 = i1;
object oi2 = i2;
int i1 = 1;
int? i2 = 1;
int? i3 = null;
object oi1 = i1;
object oi2 = i2;
object oi3 = i3;
Console.WriteLine(oi1.GetType());
Console.WriteLine(oi2.GetType());
Console.WriteLine(oi3 == null);
looks quite hacky
IList<int> list = new List<int>()
IsTypeofEqualsToGetType(list)
It should be the same as the type of object unless it's upcasted to something, which is not the case