You searched for jon skeet
. We found 71
results in 0.068 seconds.
For the most part, you can ignore this detail. But if you look through the specification, you'll see various place that the language considers conversions from type X to type Y. There are other places that the language considers... more
Yes, it's easy to deadlock, without actually accessing any data: private readonly object lock1 = new object(); private readonly object lock2 = new object(); public void Method1() { lock(lock1) { Thread.Sleep(1000); ... more
So my question is: how to declare it? You can't. All arrays in .NET are fixed size: you can't create an array instance without knowing the size. It looks to me like you should have a List<T> - and I'd actually create a class... more
Given two interfaces, I want to declare a variable that holds a reference to any object of a class that implements both interfaces Unfortunately you can't do that. You can do so for a parameter in a generic method, like this: public... more
I suspect you just want to take a copy of the list, then sort that: List<Song> sortedSongs = new ArrayList<Song>(song); Collections.sort(sortedSongs); // Will not affect song Note that this should be done before your loop,... more
Here's one option: private static readonly Dictionary<Type, string> DestinationsByType = new Dictionary<Type, string> { { typeof(Manager), @"\ManagerHome" }, { typeof(Accountant), @"\AccountantHome" }, //... more
You're using foreach on a string. Effectively: string x = "foo"; foreach (string y in x) That makes no sense - a string is a sequence of characters, not a sequence of strings. In order to get the code to compile, you could just remove... more
This is the problem: string _plantCode = appSettings["PlantCode"] ?? "Not Found"; That isn't assigning to the instance variable - it's declaring a new local variable. You just want: _plantCode = appSettings["PlantCode"] ?? "Not... more
You're probably using the 32-bit CLR in one test runner and the 64-bit CLR in another. The implementation of string.GetHashCode differs between the two. You should not depend on them being consistent between runs - they only have to be... more
How do I iterate over the loc values? The simplest way is to use the overload of Descendants which accepts an XName: foreach (var loc in siteMap.Descendants("loc")) { string value = loc.Value; ... } Currently, you're asking... more