Browsing 7239 questions and answers with Jon Skeet
Yes, that's entirely possible - at the very least theoretically - but no, you don't need a lock. Just use Interlocked.Increment: var progressDone = Interlocked.Increment(ref count) / (double) Count; (It's possible that depending on your... more 4/8/2014 4:01:38 PM
You can access the protected member from a different assembly, but only within a subclass (as normal for protected access): // In DLL 1 public class Class3 : class2 { public void ShowSample() { Console.WriteLine(sample); ... more 4/8/2014 2:04:19 PM
I suspect you just want Class.getClasses(): Returns an array containing Class objects representing all the public classes and interfaces that are members of the class represented by this Class object. This includes public class and... more 4/8/2014 1:43:28 PM
DateTime.ParseExact or DateTime.TryParseExact are appropriate here - both will accept multiple format strings, which is what you need in this case. Make sure you specify the invariant culture so that no culture-specific settings (such as... more 4/8/2014 12:53:12 PM
Why not just remove 0x if the string starts with it? There's no need to use a regular expression for this - just a combination of startsWith and substring is simpler to understand (IMO): String hexString = response.getResult(); if... more 4/8/2014 12:48:23 PM
You can use Expression.Lamdba(Type, Expression, params ParameterExpression[]) - you'd use typeof(Func<,>).MakeGenericType(typeof(TEntity), nameType) to create the relevant type. That will just give you a LambdaExpression though.... more 4/8/2014 10:44:42 AM
You should absolutely let Java handle this on its own. All you're doing is making your code harder to read and maintain. All the variables you're nulling out are going out of scope at the end of the method anyway - and the GC knows... more 4/8/2014 10:14:04 AM
As an example writing byte[] as a Srting or ByteString ? If you want to write binary data, use a bytes fields (so ByteString). A string field is UTF-8-encoded text, so can't be used for all possible byte sequences. And adding a... more 4/8/2014 8:14:47 AM
The answer is in JLS section 15.12.2. Basically, the compiler tries to find any applicable method without having to expand varargs, only using varargs if it has to: The remainder of the process is split into three phases, to ensure... more 4/8/2014 7:51:41 AM
You're writing the data to the output stream, but you're not setting a content type or a filename. You should use: response.setHeader("Content-Disposition", "attachment; filename=Result.xslx"); response.setContentType( ... more 4/8/2014 6:12:32 AM