Browsing 7239 questions and answers with Jon Skeet
XOR is a self-inverse - so you can just use: byteVar3 = byteVar.Merge(byteVar2); (I'm not sure that "merge" is a particularly good name here, mind you... you've just got an XOR operation. It's not even clear why you'd want a separate... more 6/3/2014 6:26:14 PM
Creating 1000 objects is peanuts. It should be absolutely fine, even on a mobile device. Create the objects when you read the JSON, manipulate them (as objects) within your app, and then write them out as JSON again when you need... more 6/3/2014 12:40:35 PM
The first comparison is a simple reference identity comparison - in other words, do the values of objA and objB refer to the same object (or are both null). This has two purposes in Equals(object, object): It's an optimization so that... more 6/3/2014 12:30:11 PM
This is always a potential recipe for disaster: var task = LoadAsync<User>(UserInfoFileName); user = task.Result; If this is happening in the UI thread, then you're basically blocking the UI thread until the task has completed -... more 6/3/2014 11:00:37 AM
No, absolutely not. hashCode() is not guaranteed to be unique. The rules of a hash code are simple: Two equal values must have the same hash code Two non-equal values will ideally have different hash codes, but can have the same hash... more 6/3/2014 10:34:16 AM
Your SimpleDateFormat doesn't specify a time zone, so it's using your local time zone. I would suggest: Not parsing a value at all. You've got the individual day, month and year - so use that directly with a calendar! Pass a Calendar to... more 6/3/2014 7:46:29 AM
Just qualify it with this. It's a pretty common pattern, particularly for constructors: public class Player { private readonly string name; public Player(string name) { this.name = name; } } While I view it as... more 6/3/2014 7:26:44 AM
The method is declared virtual in yyy, and overridden in every descendant class. It's one method with lots of implementations, as far as the CLR is concerned. The compiler emits a call to that method, and at execution time the CLR will... more 6/3/2014 5:44:45 AM
You're getting an exception because the radix you're providing is greater than Character.MAX_RADIX (which is 36). In other words, it's entirely predictable. Don't use BigInteger as an encoding class. That's not what it's there for. There... more 6/2/2014 9:24:22 PM
I think you're looking for KeyedCollection<TKey, TItem> Unlike dictionaries, an element of KeyedCollection<TKey, TItem> is not a key/value pair; instead, the entire element is the value and the key is embedded within the... more 6/2/2014 8:59:47 PM