Browsing 7239 questions and answers with Jon Skeet
You're currently passing an int to SimpleDateFormat... you should pass the Date value. You don't need a Calendar at all for that: // BAD CODE: DON'T USE - KEEP READING import java.text.*; import java.util.*; public class DayOfWeek { ... more 7/23/2017 2:50:25 PM
Although the namespace is Microsoft.Extensions.Configuration, the extension is in the Microsoft.Extensions.Configuration.CommandLine assembly, which is in the Microsoft.Extensions.Configuration.CommandLine package. You need to add a... more 7/23/2017 12:53:25 PM
You just need to constrain the type parameter T to be derived from your base class: // Names changed to follow .NET naming conventions private T RelocateValues<T>(BaseGrammar baseModel, T tempModel) where T : BaseGrammar { ... more 7/23/2017 12:15:51 PM
Assuming TableList has an element type that is a reference type, you can use FirstOrDefault() to return the first match or null, then the null conditional operator to only call the method if the target is... more 7/23/2017 11:06:35 AM
You're using Result, which blocks until the task completes. You're using that from the UI thread. So the UI thread will be blocked until the task completes. Now, that task comes from getStringAsync, which uses await (something). As the... more 7/21/2017 9:59:47 PM
You definitely shouldn't be parsing this by hand - Json.NET will be absolutely fine with this, so long as you model it correctly. The JSON represents a list of objects, each of which has a name (string) and a dailyClosePrice which appears... more 7/21/2017 9:46:41 PM
Two options: You could just ignore Encoding entirely, and write the loop yourself: public static bool TryParse(string s, out byte[] result) { result = null; // TODO: It's not clear why you don't want to be able to convert an... more 7/21/2017 11:54:56 AM
Namespaces have nothing to do with access. It's important to differentiate between namespaces and assemblies - they're often closely related, in that types in a namespace Foo.Bar would be likely to be in assembly Foo.Bar.dll, but that's a... more 7/21/2017 7:59:26 AM
Firstly, ignore the backslashes in the debugger. They're misleading. The string you've got is: "-1" That's the actual text of the string, as you'd see it if you printed it to the console. While you could just remove the quotes... more 7/21/2017 7:46:02 AM
No, there's nothing like that in C# at the moment. The obvious potential fix would be to allow fields to be declared using var, but that's more complicated than it may sound. I'd be somewhat surprised to see anything like Java's "diamond... more 7/21/2017 7:28:42 AM