Browsing 7239 questions and answers with Jon Skeet
What is that cast actually doing? Nothing, at execution time. That's why you'll get a warning saying that it's an unchecked cast - it's not really checking anything, because the object itself (at execution time) has no concept of... more 11/1/2014 8:48:29 AM
What should I do? You should use LINQ to XML (XDocument etc) instead. It's a far superior XML API. Once you've ported your code to use it, ditch the XmlNode (etc) code entirely - use LINQ to XML in both your desktop and mobile code.... more 11/1/2014 8:30:19 AM
if i run 10 threads, and one of these acquire lock inside foo1() other threads which want to execute foo1 will wait outside foo1() or they can loop and execute code inside foo2? Assuming they're being called on the same object,... more 11/1/2014 8:25:55 AM
As others have said, you can do this with a generic type parameter... but if you only have the value as a Type and want to pass it in as a regular argument (e.g. because it's been passed to your method that way), there's no way of doing... more 11/1/2014 1:37:18 AM
As you say, you need to have a single root node - and you need to import the other documents. For example: Element root = finalDocument.createElement("root"); finalDocument.appendChild(root); root.appendChild( ... more 10/31/2014 6:51:14 PM
It's somewhat unclear to me what you're trying to do, but if you want to count with a predicate, you could use: int count = MdiChildren.OfType<Can_ListCandidate>().Count(); which includes subclasses or int count =... more 10/31/2014 6:46:47 PM
I think I can't change my buttons' properties No, that's not true. final applies to the variable, that's all. It doesn't prevent changes to the object. In other words, this would be invalid: exL = new FlowLayout(...); // Trying to... more 10/31/2014 6:21:02 PM
What you're doing wrong is exactly what the compiler says you're doing wrong - you're trying to read from an out parameter before it's definitely assigned. Look at your code: static void Fun(out int q, out int g) { q = q + 1; ... more 10/31/2014 6:10:31 PM
I'd create a HashSet<Guid> from one of the values (any) and then check that all of the others are equal to it: // TODO: Handle the dictionary being empty var firstSet = new HashSet<Guid>(values.First().Value); var allEqual =... more 10/31/2014 3:47:30 PM
You're using Console.Read(), which reads a single character after the user has hit return. However, it only consumes that single character - which means the rest of the line (even if it's empty) is still waiting to be consumed... which... more 10/31/2014 3:06:30 PM