Browsing 7239 questions and answers with Jon Skeet
There are several problems with your code: You're using the default platform encoding to convert the binary data into text (by calling new String(byte[]) instead of specifying an encoding You're using the default platform encoding to... more 2/15/2015 10:07:41 AM
Firstly, this is only the size for interop. It doesn't represent the size in managed code of the array. That's 1 byte per bool - at least on my machine. You can test it for yourself with this code: using System; class Program { ... more 2/14/2015 10:01:41 AM
Instances don't have names, generally. (You can create a class with a Name property, but that's nothing the framework is going to care about.) The value you have to pass to PropertyInfo.GetValue is a reference to the object whose property... more 2/14/2015 9:39:39 AM
ConcurrentDictionary in .NET will allow you to do that, yes: sums.AddOrUpdate(key, value, (k, v) => v + value); You should be able to use that (with syntax changes, obviously) in PowerShell, too. Alternatively, if you want to do... more 2/14/2015 8:06:42 AM
I want to send the output in DD-MMM-YYYY format to the JSP page view. Then you need to use a SimpleDateFormat to do so. Currently you're using the result of Date.toString(), and ignoring temp which should already have the right... more 2/13/2015 5:48:30 PM
No, it "becomes" a java.util.Date value. If you're then converting it back to a string by calling Date.toString(), you should consult the Date.toString() documentation for what to expect. The value stored in the Date is just a point in... more 2/13/2015 5:29:37 PM
Firstly, I'd advise you to chain your constructors the other way round - make the ones with fewer parameters chain (possibly indirectly) to a single constructor with all the parameters, and make that the only one which sets anything. That... more 2/13/2015 5:14:26 PM
Your test is basically confusing ticks with milliseconds. If you only need to store a number of milliseconds since the unix epoch, then do so - but I'd recommend using something like this to perform the conversion: public static readonly... more 2/13/2015 4:40:25 PM
In this case, there's no real harm done in terms of the behaviour due to checking later - it's not like the code which has executed so far in the method will have had an observable impact. You'll have wasted a small amount of time, but... more 2/13/2015 4:14:33 PM
Here's a query which performs the concatenation client-side instead. As you can see, it's more long-winded - you should absolutely check that it makes a significant difference before you decide to embrace it: var dbQuery = from e in... more 2/13/2015 2:25:43 PM