Browsing 7239 questions and answers with Jon Skeet
What my actual question is... is it possible to up (down?) cast from a Foo<T, int> to a Foo<T> where T is the same type. Does it even make sense to say this, or is this something to do with co/contravariance (which still... more 5/24/2016 8:45:57 PM
In the second line, will the compiler optimize this to making a one string with Carrot added to the beginning and bean to the end, or will it create strings for Carrot and Bean, and then concatenate each to create the string? The... more 5/24/2016 4:24:32 PM
You need to make your anonymous type use Key properties, so that they participate in equality computations: Dim hourlyDayGroup2 = abpms.GroupBy(Function(a As ABPM) New With {Key a.DT, Key a.Hour}) From MSDN: Key properties differ... more 5/24/2016 4:14:55 PM
When I call Singleton.Stub() the private constructor is not being hit, when I uncomment the static ctor private constuctor is always called. It's not clear what the value of which is here, but fundamentally you've got four... more 5/24/2016 2:15:42 PM
Just calling Convert.ToInt32(EmployeerId) or int.Parse(EmployeerId) doesn't change the type of EmployeerId - both methods will return a value that you'd need to store in a new variable. You're also not doing anything with your query... more 5/24/2016 7:55:10 AM
Your client code is broken here - you're never flushing it: var sw = new StreamWriter(ns); Thread.Sleep(1000); sw.WriteLine(handshake); There's no need for the Thread.Sleep call, but you should flush the StreamWriter if you want the... more 5/23/2016 5:28:36 PM
You're using DateTime, which is documented with: Accuracy: Rounded to increments of .000, .003, or .007 seconds It sounds like you want DateTime2: Precision, scale: 0 to 7 digits, with an accuracy of 100ns. The default precision... more 5/23/2016 4:21:44 PM
According to all the tutorials I found, this should be working, even if the Parent's members are private. No, private members are only accessible within the program text of the declaring type. So if you declare LShape as a nested type... more 5/23/2016 3:21:43 PM
Don't try to convert from the byte[] to String as if it were regular encoded text data - it isn't. It's an arbitrary byte array. The simplest approaches are to convert it to base64 or hex - that will result in ASCII text which can be... more 5/23/2016 10:42:55 AM
I'm 99% sure it's historical. Basically, C# introduced iterator blocks in C# 2 - a long time before this attribute was introduced. The equivalent async attribute was introduced at the same time as async methods in C#, so that was fine...... more 5/23/2016 9:31:37 AM