Browsing 7239 questions and answers with Jon Skeet
You're selecting the user ID (resulting in a sequence of user IDs) and then calling Distincton that. The result is still a sequence of user IDs... whereas it looks like your page wants a sequence of tblGlobalLogOnLogOffStudentBan. I... more 4/16/2015 10:20:03 AM
Even a way to reach to csc.exe source code may help. (This is critical.) Judging by your comments, this is actually the bit you really need. (Trying to change int and string themselves would involve changing mscorlib and almost... more 4/16/2015 10:13:24 AM
This is a precedence issue, basically. You're assuming that your code is equivalent to: if ((test1 = false) || (test1 == false)) ... but it's not. It's actually equivalent to: if (test1 = (false || test1 == false)) ... which is... more 4/16/2015 9:28:33 AM
The whole logic of Example class is in the constructor That sounds like a poor design to start with. If you don't really need an instance, why create it? It sounds like you should probably just put the code from the constructor into a... more 4/16/2015 7:51:13 AM
Well you can extract the conditionality of the array reversal, and I wouldn't use overloads at all: public ushort GetUInt16(byte[] bytes) { ReverseIfLittleEndian(bytes); return BitConverter.ToUInt16(bytes, 0); } public uint... more 4/15/2015 4:18:40 PM
The simplest option is probably to give it a root element, then parse it as XML: var doc = XDocument.Parse("<parent>" + text + "</parent>"); If you need to append to an existing element, you can use: var elements =... more 4/15/2015 6:31:50 AM
I wonder if it is possible to use Dictionary as a object factory, in other words, given a string "Foo" I want to retrieve a new instance of my Foo class. Given then that you want to create a new instance, I would suggest using a... more 4/15/2015 6:15:30 AM
It looks like that's just XML wrapping JSON. So parse it as XML, then take the text content of the root element (the only element present) and then parse that as JSON. Basically, just do one thing at a time and you'll be fine: treat the... more 4/15/2015 6:05:32 AM
You can't do this. Basically, there's no way of symmetrically implementing Equals between two types unless they know about each other. Note that this assertion: Assert.IsTrue(SHORT_TYPE.Equals(valueType)); works due to the implicit... more 4/14/2015 5:54:30 PM
There's no multi-threading protection in List<T>, so yes, another thread could modify the list during a ToList call. The results could be: Everything's fine, and the resulting list has the new value Everything's fine, and the... more 4/14/2015 5:34:08 PM