Browsing 7239 questions and answers with Jon Skeet
If all of these classes have a getFRID() method, then that should be in an interface (e.g. Identified). Then you can use: private static <T extends Identified> boolean isPresent(T object, List<T> list) { String frid =... more 12/10/2013 11:48:55 AM
Your passing test calls bool Equals(TimeZoneInfo) Your failing test implicitly calls bool Equals(object) In the .NET 4.0 version of TimeZoneInfo, Equals(object) has not been overridden; in .NET 4.5 it has. more 12/10/2013 7:29:25 AM
How can I get rid of this error? The problem is that if the BufferedReader or FileReader constructor throws an exception, br will be null but you're still unconditionally calling br.close(). Check whether br is null before you close... more 12/10/2013 7:10:14 AM
I don't completely understand the difference between character streams, binary streams, and buffer streams Buffers are a red herring here - that's just an implementation detail, usually to make things more efficient. It's important to... more 12/10/2013 6:58:45 AM
This is the "diamond operator" (not really an operator) feature in Java 7, which allows type arguments on a constructor call to be inferred from the context in which the result is used. It's valid for Java 7, but not before. You should... more 12/10/2013 6:52:45 AM
Well array is probably an int[], given that you're using array[i] % 2 and assigning the result to an int. There's no conversion from boolean to int, so you can't store your result back in the int[] array. It's not clear what you're trying... more 12/9/2013 7:44:19 PM
Well you can change the method to not have the second parameter: Public Function ExecuteDynamicQuery(Of T As New)(ByVal sql As String) As List(Of T) Implements IGenie.ExecuteDynamicQuery However: You'd need to change IGenie as... more 12/9/2013 1:06:59 PM
You can perform the conversion in T-SQL using CONVERT, but I wouldn't. I would strongly recommend avoiding string conversions as far as possible. Just use parameterized SQL, and specify the parameter as a DateTime: // Assuming dateEnd is... more 12/9/2013 9:38:23 AM
Use String.IsNullOrEmpty which is precisely designed for checking whether a value is a null reference or a reference to a 0-length string - although it's not designed for checking for an all-whitespace string. String.IsNullOrWhiteSpace... more 12/9/2013 7:05:08 AM
Is there any particular context where ManualResetEvent is more suitable than a while loop? Absolutely. There are two primary reasons: latency and efficiency. Context-switching the thread to start it running again is relatively... more 12/9/2013 6:53:50 AM