Browsing 7239 questions and answers with Jon Skeet
Yes, it's absolutely feasible to call it hundreds of thousands of times in that period. It doesn't have a huge amount of overhead - but it's not what you should be calling for time measurement anyway. Use System.nanoTime() instead, which... more 2/15/2014 6:54:03 PM
My question is - how can I make my optional properties disappear from intellisense after they are set without creating a huge number of interfaces that grow exponentially with the number of properties? You can't with your current... more 2/15/2014 11:48:04 AM
It sounds like you just need another call to Zip. The first call will pair up the titles and dates, and the second call will pair up the title/date pairs with the links: var source = titles.Zip(dates, (t, d) => new { t, d }) ... more 2/15/2014 9:02:48 AM
Firstly, stop building your SQL dynamically like that. Use parameterized SQL instead. Next, I think you just want DATEADD. If you know that LOGIN_DATE will always be in the past, you just need to add 30 minutes to that, and check that the... more 2/15/2014 8:25:52 AM
You don't need to access it as an IEnumerable<T>. You can just use the non-generic IEnumerable: var properties = _modelType.GetProperties(); // Or whatever... remove indexers etc foreach (object item in _dataSet) { foreach (var... more 2/15/2014 8:10:55 AM
Well in the second example, it's hypothetically possible for the Random instance to be immediately collected after the WeakReference constructor completes and before the Target property is accessed - there's no strong reference to it at... more 2/14/2014 5:15:33 PM
LINQ is for querying. You should use a foreach loop to make changes: foreach (var item in custHead.lstCustomziation.Where(x => x.IsDefaultSelected)) { item.IsDefaultSelected = false; } That said, if IsDefaultSelected is false for... more 2/14/2014 2:30:14 PM
I strongly suspect this builds but doesn't show the extra item. That's because you're adding the new item to a "temporary" list that you throw away, and then you're building a new list for the data source. You want to call ToList() just... more 2/14/2014 2:26:03 PM
If you just want "the next year" it's simple: // Note: more descriptive variable names than "d" and "dd" int thisYear = DateTime.Now.Year; // Note this is in the local time zone... DateTime thisYearStart = new DateTime(thisYear, 1,... more 2/14/2014 9:58:23 AM
You're not doing anything with the data you've entered: System.out.println("Shift 1 or 2:"); shift = keyboard.nextInt(); System.out.println("Pay Rate:"); payRate = keyboard.nextDouble(); ... the shift and payRate variables aren't used... more 2/13/2014 11:10:27 PM