Browsing 7239 questions and answers with Jon Skeet
Projects (pre-ASP.NET 5, anyway) specify exactly which files are within them - Solution Explorer isn't a file-system explorer. If you right-click on the folder and choose "Add... Existing Item" then you should be able to add the new... more 2/26/2015 6:51:05 AM
I would suggest using "LINQ to JSON" instead of DeserializeObject, personally - although that may just due to having more experience with it: using System; using System.IO; using Newtonsoft.Json.Linq; class Program { static void... more 2/25/2015 10:16:36 PM
You don't really need a field for this at all - unless the validation is costly (so you want to avoid recomputing it each time it's requested) you can just have: public string Source { get; set; } public string Destination { get; set;... more 2/25/2015 7:19:12 PM
Just cast: TheProjects x = ...; PriorityForProject priority = (PriorityForProject) x.Priority; (I'd strongly advise you to rename the TheProjects type though - that's a really unwieldy, unidiomatic name...) more 2/25/2015 5:17:13 PM
Am I missing something? Yup, you're not taking into account that this is XML, where < needs to be escaped. You want: <logger name="*" minlevel="Trace" writeTo="logFile"> <filters> <when... more 2/25/2015 3:13:42 PM
However they are not recognized by catch and finally block. May I know the reason?! Sure - they're not definitely assigned. Imagine Console.ReadLine throws an exception. You catch that exception - but you haven't assigned a value to... more 2/25/2015 2:44:47 PM
The reason this code throws an exception for you is that you're presumably in a time zone which is ahead of UTC - so when DateTime.MinValue (which has a Kind of Unspecified) is converted to UTC, it's becoming invalid. The conversion is... more 2/25/2015 1:18:53 PM
The problem is the way you're using the return value of put, which is documented as: the previous value associated with specified key, or null if there was no mapping for key. (A null return can also indicate that the map previously... more 2/25/2015 1:05:19 PM
You can definitely avoid creating so many objects using the overload of append which allows you to specify a subsequence: for (...) { output.append(input, 1, 8); output.append(input, 33, 45); output.append(input, 20,... more 2/25/2015 11:52:32 AM
This is the problem, for two reasons: var str = item.Element("Document").Element("country"); Firstly, XML is case-sensitive - you want Country, not country. Secondly, those elements inherit the namespace declared with xmlns=... in the... more 2/25/2015 11:31:46 AM