Browsing 7239 questions and answers with Jon Skeet
It's not clear why you've put that in square brackets. It's as if you're trying to create an array of List<string>, using your strings as the size of the array. I suspect you meant to use a collection initializer with curly... more 1/24/2014 7:12:14 AM
There is no E[] toArray() method. Why? There's no way it could actually create an E[] at execution time, because it wouldn't know the type of array to create, due to type erasure. The add method will really accept anything, but the... more 1/23/2014 7:28:00 PM
This is the problem: new FileStream( fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite ) If the file already exists, that will overwrite the existing file, but will not truncate it. You should specify... more 1/23/2014 5:45:24 PM
The T... is just a varargs parameter, where the element type happens to be T, the generic type parameter of the class. The point is that you can call the method like this (assuming array is an Array<String>): array.addAll("x", "y",... more 1/23/2014 5:15:30 PM
I suggest you add it as a byte array. For example: byte[] bytes = new byte[] { 0, 0, 0, 0, 0, 0, 13, 191 }; cmd.Parameters.Add("@myPKRowVersion", SqlDbType.Binary).Value = bytes; If you're trying to specify bytes, the most natural type... more 1/23/2014 3:01:15 PM
This assumes they really do have the same keys: var merged = dict1.ToDictionary(pair => pair.Key, pair => new[] { pair.Value, dict2[pair.Key] }); Or to create a Dictionary<string,... more 1/23/2014 2:49:13 PM
The difference is that in the first case you're calling Enumerable.Where with a delegate (Func<Customer, bool>). The LINQ provider itself doesn't see that at all - Enumerable.Where will just iterate over the whole of the... more 1/23/2014 2:42:54 PM
Well you could use something like: bool allSameMonth = @Model.Events .Select(x => x.EventDate.Month) .Distinct() .Count() < 2; (I've taken the liberty... more 1/23/2014 1:30:29 PM
You're currently trying to write to the process's current working directory - which may well be something like C:\Windows\System32 when it's executed by the task scheduler. You're not going to be able to write there. Specify an absolute... more 1/23/2014 1:18:18 PM
Well you don't have to store all those lines - but you definitely have to read them. Unless the lines are of a fixed length (in bytes, not characters) how would you expect to be able to skip to a particular part of the file? To store only... more 1/23/2014 11:58:23 AM