Browsing 7239 questions and answers with Jon Skeet
There's no generic constraint in C# to enforce that a type argument is an interface. But where T : class is really "where T is a reference type" - it includes interfaces. If you wanted to enforce that T is an interface rather than a... more 11/30/2017 7:04:57 AM
In your original code, you haven't declared any classes - so there wouldn't be any class files. If there are no class files, presumably the compiler sees no need to create the directory structure that would have been necessary for any... more 11/29/2017 11:17:24 AM
You can return a more specific type in an override, but you can't require that you accept a more specific type. Get rid of the generics, and you can override a method returning Object with a method returning String, but you can't override... more 11/29/2017 11:09:57 AM
If you're happy to stick with TimeZoneInfo and DateTime/DateTimeOffset, you can use Matt Johnson's TimeZoneConverter library to convert the IANA ID (the part in brackets, e.g. Pacific/Kiritimati) to a Windows system time zone ID. Examples... more 11/29/2017 9:51:08 AM
Task.Delay isn't broken, but you're performing 100,000 tasks which each take some time. It's the call to Console.WriteLine that is causing the problem in this particular case. Each call is cheap, but they're accessing a shared resource, so... more 11/26/2017 12:25:37 PM
What the reason behind it i think both the codes are nearly same. Nearly, but not quite. To understand why the compiler is complaining, it's often a good idea to look at the language specification. The body of a ForStatement has to... more 11/25/2017 10:45:46 AM
Is there any way to directly update the implicitly referenced nuget-package B in my top-level-project? Sure, just add a direct dependency from your project to package B - then you can specify the version you want. When package A is... more 11/23/2017 4:09:17 PM
How is that possible? The new block was created before the old block, as seen in the timestamp. but now it is the other way around S in a SimpleDateFormat format string always represents milliseconds - not just "fractions of a second"... more 11/23/2017 11:12:16 AM
You're trying to load a file, but you're using Class.getResourceAsStream to do so. If you want to load a file, use a FileInputStream. If you want to load a resource which is accessible to a ClassLoader, use Class.getResourceAsStream or... more 11/22/2017 8:46:51 AM
From my opinion, GetString and GetBytes should be opposite operations. They are, when the data represents a valid string. However, you've tried to decode 0x80 0xD8 as a little-endian UTF-16 string - but that's not a binary... more 11/22/2017 6:27:48 AM