Browsing 7239 questions and answers with Jon Skeet
No, A isn't a reference at all. It's just the class name. A is not an expression in its own right - it doesn't have a value. It can only be part of another expression (like A.classVal or new A()). more 7/7/2015 9:16:21 AM
I would consider protected fields harmful - and I would also consider the data duplication harmful, if the values should always be the same. However, the base class could expose the private field's value via a property instead: class... more 7/6/2015 9:20:51 PM
It sounds like all you're missing is calling ToList or ToArray on the group: foreach (var group in groups) { List<string[]> pairs = group.ToList(); // Now you can access pairs[0] for the first item in the group, //... more 7/6/2015 8:39:04 PM
Well, you could create a dictionary using LINQ: // Note: assumes no empty words Dictionary<char, int> lastEntries = words .Select((index, value) => new { index, value }) .GroupBy(pair => pair.value[0]) ... more 7/6/2015 2:36:21 PM
If you really want to do this, you could use writer.WriteRaw("<![CDATA[\n" + loggingEvent.GetExceptionString() + "\n]]>"); or writer.WriteCData(loggingEvent.GetExceptionString()); However, I would strongly discourage you from... more 7/6/2015 12:21:09 PM
How can I access that non public class and my test cases are not in the same package. Change that, basically. It's pretty common practice (at least as far as I've seen) to keep your production and test classes in separate source... more 7/6/2015 10:17:04 AM
Tick is an event. .NET events are basically a representation of the pub/sub model. Event handlers subscribe to a particular event. The event publisher can raise the event whenever they like, at which point all the event handlers are... more 7/6/2015 8:08:56 AM
In the case of int to byte, there's no real concern about a loss of precision, because both types have the same degree of granularity. You'll get an error if you try to convert a literal with a value outside the range of byte to byte. (The... more 7/6/2015 5:50:12 AM
Why it is Nan and not double NaN isn't a type, it's a value - and I suspect you're getting it because x2 is negative. The result of the square root of a negative number is undefined in real numbers (as opposed to complex numbers), so... more 7/5/2015 7:06:01 AM
I don't have much experience with this, but it looks like if the VB compiler is able to infer the type arguments, it doesn't let you specify them explicitly. Assuming bytes is a Byte array (or an IEnumerable(Of Byte)), you should be able... more 7/5/2015 6:59:27 AM