Browsing 7239 questions and answers with Jon Skeet
I would consider wrapping double in a struct rather than a class. There's no way of saying "T must either be double or implement IBar" but wrapping a primitive value in a struct is entirely reasonable (assuming it actually makes sense for... more 2/27/2014 6:07:11 PM
I'm expecting a valid pdfsharp return that I'm saving to a file. If it's meant to be a PDF file, I wouldn't try to convert that to a string at all. It's simply not text - it's binary data. It should be as simple as: byte[]... more 2/27/2014 6:02:05 PM
The operating system is responsible for cleaning up unmanaged resources when the process terminates. So if you're happy for the resources to be allocated from the point at which you first use the resource until the program termination, I... more 2/27/2014 2:23:28 PM
Should I just accept a CancellationToken as an arg and let the user create the token source if needed? This. But you should quite possibly return a Task as well, so that the user can observe when it's completed etc. This is amenable... more 2/27/2014 1:37:35 PM
It's not about how many bits of data are used. It's about the scale that can be represented. From JLS section 5.1.2 (widening primitive conversions): A widening primitive conversion does not lose information about the overall... more 2/27/2014 11:46:21 AM
Three options: If ObjectManager.Instance.Objects is a List<T>, use List<T>.RemoveAll with a predicate, making your code much simpler: // This replaces your whole loop... ObjectManager.Instance.Objects.RemoveAll(x => x is... more 2/27/2014 11:35:30 AM
Two options: First, optionally use Where: var events = pointsCore.Categories.SelectMany(c => c.Events); if (!string.IsNullOrEmpty(firstName)) { events = events.Where(e => e.Firstname == firstName); } var result =... more 2/27/2014 11:33:09 AM
SQL server holds DateTime in EU Format No, it doesn't. (At least, not if it's in an appropriate column type in the database.) It holds it in a more compact binary format - at least so I assume. That's an implementation detail though.... more 2/27/2014 10:38:28 AM
You've got this: using (WebClient client = new WebClient ()); in the list of using directives when you really meant it to be a using statement in the method: static void Main(string[] args) { using (WebClient client = new... more 2/27/2014 10:29:45 AM
I would parse this as a DateTimeOffset instead of a DateTime - after all, that's the data you've been given. Assuming it's always specified using GMT+... you can use a format string of "ddd MMM d yyyy HH:mm:ss 'GMT'zzz". In particular,... more 2/27/2014 10:25:53 AM