Browsing 7239 questions and answers with Jon Skeet
With your current code, you logically want: IEnumerable<Video> result = from vid in videos where selectedTags.All(tag => vid.Tags.Any(t => t.Name == tag)) ... more 3/26/2014 3:53:44 PM
List<T>'s resizing is based on creating a new array behind the scenes when it needs to. Think about what the underlying implementation looks like here. When you allocate an array, it reserves a chunk of memory, and the reference... more 3/26/2014 9:26:38 AM
One fairly "old-school" way of handling this would be to return a continuation token - basically a job ID saying, "Check this periodically; sooner or later it'll come back with a result." Given that even 30 seconds is quite a long time,... more 3/26/2014 8:49:43 AM
Assuming the retrieved value will be of the right type, just cast it: radioButton.Checked = (bool) Properties.Settings.Default[radioButton.Name + "IsChecked"]; more 3/25/2014 12:21:32 PM
This is the problem: SqlParameter pa2 = new SqlParameter("@DTime", DbType.DateTime); pa2.Value = DateTime.Now.ToString(); You've said the parameter is a DateTime, but then you're converting it to a string - and quite possibly doing so... more 3/25/2014 11:17:41 AM
This method is the problem: public static int recursivesum(int n, int m) { if (n < m) { int s = n; // Variable declared here... scoped to the if s += recursivesum(n+2, m); } else { if (m < n) { ... more 3/25/2014 9:38:23 AM
can I create object of my class from main method and How? No. Only the met method knows anything about the class. If you want to use the class outside that method, you should declare it either as a nested class within Demo, or as a... more 3/25/2014 8:03:35 AM
In the first case, you just have three local variables declared in the constructor. In the second case, your Tool class has three fields. You can then refer to those fields in other methods, and they are part of the state of the... more 3/24/2014 6:54:30 PM
() => is the start of a lambda expression that doesn't have any parameters. It's important to understand that a lambda expression can't exist in a vacuum - it's always part of a conversion to either a delegate type or an expression tree... more 3/24/2014 5:12:11 PM
Yes, there's a big difference between those two. Not for those particular values, but the exact same expression with different values will show the difference. In the first version, the addition is done in 32-bit arithmetic, and then the... more 3/24/2014 2:57:43 PM