Browsing 7239 questions and answers with Jon Skeet
The obvious solution is to just re-create the SqlConnection object every time a database call requires one - in this case, it would never be shared. Is there any reason not to do this? On the contrary, that's absolutely what you... more 5/29/2014 8:31:02 PM
You should use a Decoder, which is able to maintain state between calls to GetChars - it remembers the bytes it hasn't decoded yet. using System; using System.Text; class Test { static void Main() { string str =... more 5/29/2014 6:49:52 PM
This is the problem: private static void calc_T(Matrix[] Ts, Double[][] T) { T = Ts[0].x; ... } Arguments in Java are passed by value. So basically, you're ignoring the original value of T, assigning a new value to it, and then... more 5/29/2014 5:59:21 PM
Three problems: Just because T is "Task or a derived type" doesn't mean that it's Task or Task<T>. What would you expect if I called MyMethodAsync<MyCustomTask> where MyCustomTask derives from Task? The compiler needs to know... more 5/29/2014 5:37:57 PM
You can't, basically. Parameterized SQL is just for values - not table names, column names, or operators. This is one place where you do probably want to build the SQL dynamically - but with a white-listed set of options. Whether you... more 5/29/2014 5:27:57 PM
It sounds like this is basically broken by design, if you have very similar types all with the same members (and even the same simple name) but with no type relationship between them. If this is generated code and the types are all... more 5/29/2014 4:56:53 PM
As noted, it was already working apart from putting the results at the beginning. To fix this, I'd add an extension method: public static int IndexOfOrMax(this IEnumerable<T> source, T item) { int index = source.IndexOf(item); ... more 5/29/2014 4:37:34 PM
The problem is that the exact values you're calling toFixed on aren't 1.35 etc... they're the nearest IEEE-754 64-bit representation. In this case, the exact values... more 5/29/2014 2:16:42 PM
If you want XML of: <Customer_ID xmlns="a"> <Email> </Email> <Home_Address> </Home_Address> <Mobile_Number> </Mobile_Number> </Customer_ID> ... then you need to make sure your... more 5/29/2014 1:12:50 PM
Yes, Collections.unmodifiableList does create a new object each time - but it's a pretty cheap operation. (It doesn't have much work to do.) I'm not sure that the data model of a GUI is likely to fetch the collection over and over again -... more 5/29/2014 6:17:31 AM