Browsing 7239 questions and answers with Jon Skeet
The difference is in precedence. | has higher precedence ("binds tighter") than =. So this: if(b=true|_false()) is effectively: if (b = (true | _false())) ... Likewise this: if(b=true|(b=false)) is effectively: if (b = (true... more 1/16/2014 11:08:33 PM
Any ideas on how the 2 backslashes are appearing? Yes. You're almost certainly looking at the string in the debugger. The actual string only has a single backslash. Log it, write it out to the console, display it in a form or whatever... more 1/16/2014 11:01:51 PM
So why can't I modify the array type by casting? Casting never changes the type of an actual object. It just checks that the reference in question is a reference to an object of an appropriate type, and lets you use that reference... more 1/16/2014 7:24:58 PM
p.s.w.g has explained what's wrong with the existing code, but I'd probably just use LINQ to do it all in one go: var colors = Enum.GetValues(typeof(KnownColor)) .Cast<KnownColor>() // Or cast the array ... more 1/16/2014 5:38:11 PM
Just launch the JVM with an appropriate security manager which prevents reflection. You should run code you don't trust under a pretty stringent security manager. You don't need to change the String class - just run in a tighter... more 1/16/2014 5:16:42 PM
Neither. Assuming you don't need _context to be a field (there's no indication that you do) you should make it a local variable: private void Form1_Load(object sender, EventArgs e) { using (winappContext _context = new... more 1/16/2014 4:08:09 PM
Is any diference? Absolutely. Consider: double value = -5; this.Value = -value; // Sets Value to 5 this.Value = Math.Abs(value) * -1; // Sets Value to -5 Focus on correctness and simplicity before performance. What are you actually... more 1/16/2014 3:19:48 PM
You're specifying a string as the deadline date value. You should specify a DateTime instead. You can use DateTime.Parse (or DateTime.ParseExact, or DateTime.TryParseExact) to parse the text representation if you really have to - but it... more 1/16/2014 3:17:24 PM
This would be a simpler approach: var query = AllePlayer.GroupBy(player => player.coachNumer, (coach, players => new { Coach = coach, ... more 1/16/2014 2:31:41 PM
It's pointless to make a type parameter with a struct constraint covariant. Generic variance isn't supported for value type type arguments at all - so for example, there's no conversion from IEnumerable<int> to either... more 1/16/2014 2:09:13 PM