I have a type lets call it "MyType". I have a List(Of MyType). Here is what i'm doing:
MyList.Sum(Function(x) x.MyFieldToTotal)
"MyFieldToTotal" is a decimal. For the life of me i can't figure out why x above is an object rather than a type of "MyType". Shouldn't Type Inferencing be working in this case? Even in intellisense i get "selector as System.Func(Of MyType) as Decimal"
To test the differences between C# & vb.net i did the following:
dim MyVar as new list(Of System.IO.FileStream)
MyVar.Sum(Function(x) x.
List<System.IO.FileStream> MyVar = new List<System.IO.FileStream>();
MyVar.Sum(x=>x.
In VB.Net x was of type Object while in C# x was of type FileStream. So why is type inferecing working in this case with c# and not vb.net?
Also, note that "Option Infer" is ON