Browsing 7239 questions and answers with Jon Skeet
When I say crazy, I mean like 8192 bits integers and floats. That's really not that crazy. It's not like that's going to tax the memory in your machine or anything. Use BigInteger for integers, and BigDecimal for floating point... more 1/16/2015 10:43:23 AM
What is the use of static methods in Enums? Same as in any other type. For enums, they're often "given this string value, return the equivalent enum" or something similar. (In cases where valueOf isn't appropriate, e.g. where there... more 1/16/2015 10:22:57 AM
Just use the DateTime.Date property: if (fromDate.HasValue) { filterResults = filterResults .Where(d => d.LastModifiedAt.Date >= fromDate.Value.Date); } if (toDate.HasValue) { filterResults = filterResults ... more 1/16/2015 9:31:28 AM
You can easily do this with LINQ to JSON (JObject and friends). Here's a short but complete example: using System; using System.Collections.Generic; using Newtonsoft.Json.Linq; public class Employee { public string EmployeeNumber {... more 1/16/2015 7:35:42 AM
Being able to store the maximum value of UInt32 without losing information doesn't necessarily mean you'll be able to store all values in UInt32 without losing information - after all, there are plenty of long values which can be stored in... more 1/16/2015 7:14:51 AM
When you create the project, make sure you set the .NET Framework version to 4.5, not 4.5.3. (I've run into exactly this problem before, and setting the version to 4.5 fixed it. I believe this is a known issue, and I'd expect at least a... more 1/16/2015 7:04:53 AM
Basically you're using the wrong overload of toArray. You want the one accepting an array T[], which is declared to return a T[] as well. It uses the execution-time type of the array to work out the type of array to create - it can't do... more 1/16/2015 6:55:55 AM
You've written "Hello World" in the platform default encoding - which is likely to use a single byte per character. You're then reading RandomAccessFile.readChar which always reads two bytes. Documentation: Reads a character from this... more 1/15/2015 8:48:02 PM
I would have expected the runtime to automatically cast the returned value to whatever the type requested by the method is (int, in this instance). Why would you expect it to do that? There's no implicit conversion from double to int... more 1/15/2015 5:18:03 PM
The simplest approach is probably to make your implementations private classes inside the base class: public abstract class Vehicle { public static Vehicle GetVehicle() { if (Context.IsMountain()) { ... more 1/15/2015 5:07:49 PM