Browsing 7239 questions and answers with Jon Skeet
There's an implicit conversion from int constants (not just literals, but any compile-time constant expression of type int) to byte, so long as the value is in range. This is from section 6.1.9 of the C# 5 specification: An implicit... more 7/4/2015 9:21:11 PM
You couldn't have Node firstNode = new Node(); later on in the code - because that would be trying to declare a new local variable with the same name as an existing one. (You can have a local variable with the same name as an instance... more 7/4/2015 7:43:01 PM
If the service just returns "1435775316000" then that isn't really JSON - or at least, it's not a JSON object, which is at least a rather more widely-used approach to returning JSON. You can just parse it with long.Parse: long value =... more 7/4/2015 3:38:04 PM
Yes, because 49 is the UTF-16 code unit for the character '1'. If you entered "ABCD", it would show 64, 65, 66, 67. Convert.ToInt16(char) is documented as: Converts the value of the specified Unicode character to the equivalent... more 7/3/2015 6:44:30 PM
The -D needs to come before the class name, because anything after the class name is regarded as an argument to the Java app itself... and the Java app may choose to do anything it likes with -D, or any other JVM options. Basically, the... more 7/3/2015 4:35:36 PM
So just include it as you have in the commented-out code: .GroupBy(r => new { Rate = ((int)(r.Rate / BucketSize)) * BucketSize, r.ExpiryDate }) more 7/3/2015 10:11:38 AM
It sounds like you should be using BigDecimal - create a BigDecimal from the long, and then scale it by 3 places: BigDecimal bd = new BigDecimal(duration).scaleByPowerOfTen(-3); String durationStr = formatter.format(bd); By using... more 7/3/2015 8:13:11 AM
You should just make the arrays in the JSON match with list or array types in your POCO. Here's a short but complete example using the JSON you've provided: using System; using System.Collections.Generic; using System.IO; using... more 7/3/2015 6:24:07 AM
The only value you can use for the default value of an optional object parameter is null - or equivalently, default(object). There are no other compile-time constants of type object. I'm slightly surprised that you can't use a string... more 7/2/2015 9:41:31 PM
You're creating a list of instances of an anonymous type with three properties (AmountPaid, ApplicationDate, and Type). Your method expects a List<Collection>. Assuming that Collection is a type with the same properties, you probably... more 7/2/2015 7:36:39 PM