Browsing 7239 questions and answers with Jon Skeet
I've certainly seen some odd LINQ behaviour before now, due to the way that SQL handles nulls not being the same as the way that C# handles nulls. In C#, a == b is true if a and b are both null, whereas in SQL they're not... instead you... more 5/10/2016 3:59:46 PM
Changes to the iteration variable in an enhanced-for statement do not affect the underlying collection. So while this modifies the array: test[i] = new Test(); // In for loop ... this doesn't: test = new Test(); // In enhanced for... more 5/10/2016 10:11:32 AM
This answer assumes you're doing more than just creating a File object - that you're actually creating a file on the file system. (A File object is just a logically representation of a file system entry which may or may not exist.) If... more 5/10/2016 6:11:33 AM
if JIT replaces some getters/setters with actual value while compiling a code how purpose of getter/setter is fulfilled in java particular ? Because it's only an optimization. The getters and setters still work exactly as expected -... more 5/9/2016 7:32:49 AM
How is call to call('a', 'a'); is ambiguous? Because in order for the (char i, Character j) overload to be applicable, the rules around boxing are brought into play - and at that point both calls are applicable. This is the second... more 5/8/2016 11:26:11 AM
Is the post increment simply to increment the value in count[a[i]] by 1 and store it there? Yes, exactly. There are two side-effects of the statement: one is a modification to an element of aux, and the other is a modification to an... more 5/8/2016 7:18:13 AM
Sure - you just need to update the label periodically, which can easily be done with a DispatcherTimer. Just register an event to fire periodically - say 10 times per second - and update the label with the system time every time the event... more 5/7/2016 4:21:14 PM
You could use IndexOf with a case-insensitive comparison: var query = posts.Where( logg => logg.IndexOf(searchKey, StringComparison.CurrentCultureIgnoreCase) != -1); foreach (string result in query) { ... more 5/7/2016 3:44:41 PM
LINQ only supports equijoins, but you could do an equijoin for the weekday and starttime, and endtime parts and then a where clause for the rest. // Names changed to be more idiomatic where feasible. We have no // idea what "sl"... more 5/7/2016 10:09:30 AM
Basically, it depends on two things: Whether the StreamWriter constructor will ever throw an exception when passed a non-null Stream reference - and I don't think it will in this case. (If the stream were read-only, it would... at which... more 5/6/2016 4:46:59 PM