Browsing 7239 questions and answers with Jon Skeet
I suspect you just want to use the % operator: int length0 = inputArray.GetUpperBound(0); int length1 = inputArray.GetUpperBound(1); ... var value = inputArray[x % length0, y % length1]; Note that this will not wrap negative numbers,... more 3/21/2014 1:20:05 PM
Would the speed of sorting differ with 100 string items which are all 30 string characters? Potentially, yes. Potentially, no. It depends. If you have a bunch of strings which only differ at character 30, that will take longer to sort... more 3/21/2014 1:15:08 PM
For some reason Visual Studio doesn't accept the access to this runtime field of this dynamic object. Well what you've provided is simply not valid C#. An identifier can't start with a digit. That's still enforced even when you're... more 3/21/2014 1:12:04 PM
Basically you've got a List<Integer> and you're trying to store the contents of it in a String[]. You can't do that. If you want to convert each Integer into a String, you'll need to do that explicitly. For example: String[]... more 3/21/2014 12:59:10 PM
I'd use Json.NET for this - it lets you build up the JSON dynamically: using System; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json.Linq; class Program { static void Main(string[] args) { var... more 3/21/2014 7:17:25 AM
The problem is that after you've changed ( to ), the second if statement will immediately be true, so the character is flipped back again. The reverse isn't true though - if you start off with ) that will be flipped by the second... more 3/20/2014 8:55:44 PM
Firstly, you don't need to use Luna - there's a feature patch for Kepler which works fine. Secondly, the "source compatibility" part of the Java Compiler dialog has to be 1.8. Otherwise even though you're allowed to use the library... more 3/20/2014 8:17:17 PM
Why does a slash make difference when using new URI(baseUri, relativePath)? Well, that's what happens on the web normally. For example, suppose I'm looking at http://foo.com/some/file1.html and there's a link to file2.html - that... more 3/20/2014 7:59:48 PM
The problem is that File.Move takes two filenames, whereas you're providing a filename and a directory. You can fix your code by creating the appropriate target filename: string targetFile = Path.Combine(targetPath,... more 3/20/2014 7:54:20 PM
Is it that the type T is erased after the constraints are met and then it just behaves using the base class? It depends on what you mean by "the type T is erased". It's not erased in the same way that it is in Java - the type argument... more 3/20/2014 3:35:09 PM