Browsing 7239 questions and answers with Jon Skeet
If you've got a value which is "a string serialized as JSON", then just deserialize that first. Assuming your string genuinely starts and ends with a double quote, you should be fine to call JsonConvert.DeserializeObject<string> to... more 5/23/2017 11:01:22 AM
All the overloads accepting a Writer have been removed - but instead, CharSequenceTranslator instances are available, so you could write: StringEscapeUtils.ESCAPE_XML10.translate(input, writer); (Personally I'd strongly recommend using... more 5/23/2017 7:31:10 AM
No, there's no equivalent of method group conversions for constructors, or properties, indexers or operators. It's an entirely reasonable idea, but it isn't in C# at the moment. It is, however, tracked as part of a feature request in the... more 5/23/2017 6:42:46 AM
But why does Sparta in MakeItReturnFalse() refer to {namespace}.Place.Sparta instead of {namespace}.Sparta? Basically, because that's what the name lookup rules say. In the C# 5 specification, the relevant naming rules are in section... more 5/22/2017 8:02:07 PM
TL;DR: Update to Noda Time 2.0.2. This was a bug in 2.0.0 and 2.0.1 of Noda Time. Brief testing suggests it wasn't an issue in earlier versions. The problem was due to an optimization when trying to obtain the time parts of a period... more 5/22/2017 4:26:34 PM
Well in your second code, B and H are local variables within the block - you're not assigning to the field at all. That's exactly the same as if you were writing a method... Forget static initialization for the minute - imagine you had... more 5/22/2017 6:17:45 AM
You can do this via expression trees, but the way your sample code is set up makes it look like you want just a Func<object>, which means the task has to be already embedded in the expression tree. You can do that: using... more 5/21/2017 6:56:12 PM
You shouldn't be including the value in your grouping - you want to group by just Desc and Month (I assume), then sum the value parts. Two options: var sums1 = objList .GroupBy(y => new { y.Desc, y.Month }) .Select(group =>... more 5/21/2017 6:20:01 PM
You would need to target multiple frameworks in the csproj file. In the original launch of Visual Studio 2017 there's no UI for this, but you can do it manually. I believe that there will be UI support for this in an update. It's just a... more 5/21/2017 11:15:21 AM
Your current code is going through all kinds of steps it doesn't need to. All you need is: string text = File.ReadAllText("input.txt"); Encoding encoding = Encoding.GetEncoding(1258); File.WriteAllText("output.txt", text,... more 5/21/2017 8:39:22 AM