Browsing 7239 questions and answers with Jon Skeet
this two piece of code should return the same string for the same image file No, they really shouldn't. The C# code is returning the base64 representation of a JPEG-encoded version of the image data - and potentially some 0s at the... more 2/26/2014 9:10:05 AM
Only methods declaring that they return IEnumerable<T>, IEnumerable, IEnumerator or IEnumerator<T> can be implemented with iterator blocks. That rules out all async methods. Fundamentally it's not clear how they'd work anyway,... more 2/26/2014 8:57:47 AM
I would split it into two methods: one public one with just the "natural" parameters, and one private one with two parameters (in this case n and count), passing in the initial value. You won't need to modify count within the method - just... more 2/26/2014 7:27:19 AM
How do you create the return of a method that has the return type as the class? The same way you handle any other use of a reference. In your case you could just change your code to: return this; However, that's adding the given... more 2/26/2014 7:07:19 AM
If I understand the question correctly, you just want: DateTime target = new DateTime(2014, 2, 24, 18, 0, 0); TimeSpan remaining = target - DateTime.Now; There's no need to parse a string just to get a DateTime value, if you already... more 2/25/2014 7:36:30 PM
If you want to see the full response, I suggest you use WebRequest/WebResponse instead of WebClient. That's a more low-level API - WebClient is meant to make very simple tasks (such as downloading the body of a response as a string)... more 2/25/2014 7:31:17 PM
You're unconditionally breaking out of the for loop at the end of the first iteration of the for loop. That has nothing to do with "when the first null object is found" - it's just at the end of the body of the loop. Additionally, your... more 2/25/2014 6:15:56 PM
Instead of doing the database query in OnDayRender, do it when your form initially loads, and fetch the data for the whole month (or whatever the range of the calendar is) into a List or something similar. Then your OnDayRender code can... more 2/25/2014 4:57:25 PM
You can just use the Control property and then cast: var control = (C1DropDownControl) controlHost.Control; // Use the various properties more 2/25/2014 2:11:02 PM
Well you're reading until the socket is closed, basically - that's when read will return -1. So my guess is that the other end of the connection is holding it open for 90 seconds before closing it. Fix that, and you'll fix your problem. more 2/25/2014 12:03:32 PM