Browsing 7239 questions and answers with Jon Skeet
Is there an advantage that ref parameter has over return value? personally i don't see a massive difference. Well typically, ref is used when there's already something else being returned - e.g. for int.TryParse (which uses out, but... more 9/22/2016 4:37:31 PM
Conditional compilation is supported by both C# and VB: C#: #if DEBUG Foo(); #else Bar(); #endif VB: #If DEBUG Then Foo #Else Bar #End If Macros are not supported in C# or VB as far as I'm aware... typically inlining is... more 9/22/2016 4:14:15 PM
You seem to be assuming that a java.util.Date "knows" a format. It doesn't. That's not part of its state - it's just the number of milliseconds since the Unix epoch. (There's no time zone either - the IST you're seeing there is your local... more 9/22/2016 1:00:20 PM
It sounds like what you really want is to trigger the text change when the MediaEnded event is fired. You could do that within your ChangeToSpeech method, although it'll be a little ugly: public async static Task ChangeToSpeech(string... more 9/22/2016 9:26:47 AM
Scanner.next() reads the next token. By default, whitespace is used as a delimited between tokens, so you're only getting the first word of your input. It sounds like you want to read a whole line, so use Scanner.nextLine(). You need to... more 9/22/2016 6:14:11 AM
Is there a way to handle each result on demand? Yes, you use WhenAny instead of WhenAll... or call ContinueWith on each task. For example, for the WhenAny approach: ISet<Task<TimeSpan>> tasks = new... more 9/21/2016 6:54:24 PM
As far as I can tell, TimeZoneNames is all about just the time zone names themselves - it doesn't know anything about the time zone data itself. If you want to know whether America/Phoenix is currently observing daylight savings, I'd... more 9/21/2016 3:46:40 PM
The compiler has to perform overload resolution for the call of new Greeter().SayHi(person); At that point, the type of person is just T, and all it knows is that T is implicitly convertible to Person. Therefore, the only applicable... more 9/21/2016 10:18:19 AM
Reads within the lock block see the latest versions of a variable and writes within the lock block are visible to all threads. No, that's definitely a harmful oversimplification. When you enter the lock statement, there a memory... more 9/20/2016 7:56:00 PM
This certainly isn't a terribly common scenario, but it's definitely supported. (Unlike creating your own calendar, for example.) You'd specify daylight saving via GetZoneInterval - that method is the key to the class. The important... more 9/20/2016 7:43:17 PM