Browsing 7239 questions and answers with Jon Skeet
Once you've got the PropertyInfo for the property you're interested in, you just call GetCustomAttributes on it: ForeignKey[] keys = (ForeignKey[]) property.GetCustomAttributes(typeof(ForeignKeyAttribute), false); There's also the... more 10/23/2013 4:55:34 PM
Does a new thread get created to run //Code after await? Maybe. Maybe not. The awaitable pattern implementation for Task runs the continuation (the bit after the await expression) using the synchronization context which was "current"... more 10/23/2013 1:47:06 PM
I am getting an error saying "no overload for method 'getDeposit' takes 0 arguments". What am I doing wrong Exactly what it says. Here's your method call: Console.WriteLine(" output {0}", account.getDeposit()); ... and here's the... more 10/23/2013 6:44:08 AM
The answer lies in the documentation - emphasis mine: (A structural modification is any operation that adds or deletes one or more elements, or explicitly resizes the backing array; merely setting the value of an element is not a... more 10/22/2013 6:19:46 PM
Are we casting the method to a delegate? Well, you're not casting - but you're using a method group conversion to convert a method name into a delegate. I thought the event wants a method to be subscribed to it? No, an event... more 10/22/2013 5:17:55 PM
You pass the UTC time back to the client, and let the client do the UTC to local time conversion. Either that, or you need to make the client pass in the time zone, which is a pain in other ways. Usually it's better to stick to UTC for as... more 10/22/2013 4:37:07 PM
The problem is that an IOrderedQueryable needs to be able to apply a secondary ordering - and by the time you've projected the item/metric pair to just an item, you've lost the primary ordering. One approach would be to defer the... more 10/22/2013 3:44:33 PM
Well it's not really optimization, but your code would be simpler as: if (!Override || match.Groups[2].Value == OverrideFileName) { var df = new DownloadFileStruct(match.Groups[1].Value, ... more 10/22/2013 3:17:48 PM
Your SimpleDateFormat is in "lenient" mode - which is very lenient indeed. If you use promsiedDateTimeFormat.setLenient(false); it will throw an exception as you'd expect when you try to parse the bogus data. Personally I think it... more 10/22/2013 3:01:03 PM
(I'm assuming you want the filtered list as well - the other answers given so far only end up with the sum, not the list as well. They're absolutely fine if you don't need the list, but they're not equivalent to your original code.) Well... more 10/22/2013 2:43:52 PM