Browsing 7239 questions and answers with Jon Skeet
As the documentation says, "This is primarily intended for low-level conversions rather than general application usage." Going via Instant makes perfect sense to me - your epoch second is effectively a different representation of an... more 9/17/2015 9:29:31 AM
Yes, this is because an int takes 4 bytes in a buffer, regardless of the value. ByteBuffer.putInt is clear about both this and the exception: Writes four bytes containing the given int value, in the current byte order, into this... more 9/17/2015 9:17:50 AM
is there a way that make c# automatically recognised the "Culture" of the pc where is installed so that it can read the number correctly? That's what it's doing by default - and why you're having a problem, because the culture used to... more 9/17/2015 7:22:58 AM
What happened to Mario ?? You changed it, basically. Yes, with reflection you can violate the immutability of strings... and due to string interning, that means any use of "Mario" (other than in a larger string constant expression,... more 9/17/2015 6:34:28 AM
You can't overload the method like that, no - they have the same signatures. Your options are: Use one implementation, which will be called by both interfaces Use explicit interface implementation for one or both of the methods,... more 9/17/2015 6:10:12 AM
Your method doesn't fill an array - it creates a new array. (It's also not at all clear what the parameters are meant to be for.) If you want it to fill an existing array, you should have that as the parameter: public static void... more 9/16/2015 8:56:52 PM
You can call Skip for the minimum number minus 1, and then check if there are any left: public static bool AtLeast(this IEnumerable<T> source, int minCount) { return source.Skip(minCount - 1).Any(); } Note that for large... more 9/16/2015 6:50:38 PM
It sounds like you want something like: var fruit = collectXml .Descendants("Fruit") .Select(x => new Fruit { Col = (string) x.Element("Location").Element("Col"), Row = (string)... more 9/16/2015 5:05:09 PM
Is it possible to add new items in that list? Nope... because that code doesn't know what it's "actually" a list of. Imagine if you could: List<String> strings = new ArrayList<>(); List<? extends Object> objects =... more 9/16/2015 4:57:17 PM
No, you can't do that - partly because it wouldn't make sense at compile time. Consider a slight change to your code: BaseClass instance = new DerivedClass(); var editor = instance.CreateEditor(); What could the compiler infer the type... more 9/16/2015 8:32:42 AM