Browsing 7239 questions and answers with Jon Skeet
Assuming this really is decimal, I suggest you round the decimal value first: decimal rounded = Math.Round(original, 2); string roundedText = XmlConvert.ToString(rounded); Obviously you can specify appropriate rounding/truncation... more 6/10/2014 10:36:46 AM
No, there's no kind of "interface for static methods" in Java. (Aside from anything else, how would you expect to specify the class in question? Even generics wouldn't help here due to type erasure.) more 6/10/2014 10:24:31 AM
This partly depends on how much you want to balance code complexity vs data fetching efficiency. You could always succeed by fetching twice as much data as you need: int virtualTake = take * 2; int virtualSkip = skip / virtualTake; var... more 6/10/2014 6:02:23 AM
You're currently trying to use a for loop in the middle of a statement. That's not going to work. Options: Use Enumerable.Range to create a range of values, and then transform that using Select: XDocument myDoc = new XDocument( new... more 6/9/2014 7:07:47 PM
A local variable declaration - with or without initialization - is a statement, as specified in section 14.4 of the JLS. It's important to note that this is not an expression in the way that a simple assignment expression is - you can't... more 6/9/2014 6:56:47 PM
Assuming you're trying to handle a stream of messages, sounds like what you're missing is a way of specifying (in the stream) how big your messages are (or where they end). I suggest you just write a prefix before each message, specifying... more 6/9/2014 5:00:17 PM
Use the fact that you've already got a Uri via the Request property - you don't need to do it all manually: Uri pageUri = new Uri(HttpContext.Current.Request.Url, "/ThePageName"); Then build your tag using that - but ideally not just... more 6/9/2014 4:42:29 PM
You need to specify the nested name: @foreach(listDevicesModel.Device d in Model.devices.device) Or use implicit typing: @foreach(var d in Model.devices.device) Personally I'd avoid using nested classes here anyway, unless you really... more 6/9/2014 11:55:02 AM
EDIT: The reason your current code is failing is pretty simple - you're trying to parse an empty string: string feedAsString = ""; ... var rssFeedAsString = contentReader.ReadToEnd(); rssFeedAsString =... more 6/9/2014 8:35:30 AM
You're using a writer, and you're calling Writer.write(int): Writes a single character. The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored. So you've got... more 6/9/2014 5:53:47 AM