Browsing 7239 questions and answers with Jon Skeet
Well one simple approach would be to use base64 - but perform the conversion on class initialization, so you only take the performance hit once: private static final byte[] CDRIVES = Base64.decode("YOURBASE64HERE"); Or if it's genuinely... more 7/30/2015 7:32:10 AM
You can't, basically. You've got a rectangular array, which is a single block of memory. You could write your own wrapper around that, e.g. public RectangularArrayRow<T> : IList<T> { private readonly int row; private... more 7/30/2015 5:50:35 AM
Rather than using Nodes, it would be simpler to use Elements, so that you can then use the Attribute method to retrieve each attribute: var parameters = doc.Root .Element("Valid") ... more 7/29/2015 3:25:31 PM
arr2 is exactly a String[] No, it isn't - it's an Object[], as you said - your line is equivalent to: Object[] arr2 = new Object[] {"a", "b", "c"}; It's an Object[] which happens to have elements which are all string references at... more 7/29/2015 12:46:26 PM
Well, you've initialized small as 0 to start with... so you're only going to update it if there are negative numbers. Likewise you've initialized large as 0, so you'll only update that if there are positive numbers. Enter all-negative... more 7/29/2015 6:18:20 AM
There are three problems here, which are related. Basically, you're assuming that get because you can read from a resource, you can write to a file in the same folder structure, relative to the current directory. That's a flawed assumption... more 7/29/2015 6:02:09 AM
It's because you've redeclared the Print method in Child. So at compile time, P.Print() resolves to Parent.Print, but C.Print() resolves to Child.Print(). If you had a virtual method which was overridden in Child instead, they'd both print... more 7/28/2015 6:49:46 PM
Previously, you had to specify the warning number. So to disable CS0501, you'd use #pragma warning disable 0501 Now, you can use #pragma warning disable CS0501 ... which is incredibly important when you've got Roslyn Code Analyzers... more 7/28/2015 4:53:47 PM
How do I make this a generic extension method? You can't, at the moment... because C# doesn't allow you to constrain a type parameter to derive from System.Enum. What you want is: public static string GetIdForEnum<T>(T value)... more 7/28/2015 4:48:37 PM
You're seeing the difference of calling different overloads of String.valueOf. Here's a simpler example: public class Test { public static void main(String[] args) { char[] chars = { 'a', 'b', 'c' }; ... more 7/28/2015 12:49:04 PM