Browsing 7239 questions and answers with Jon Skeet
Isn't the goto moo and static void moo() doing the same act i.e taking me out of finally block? No, absolutely not. goto moo would transfer control out of the finally block completely. moo() just calls the method, but then when the... more 10/31/2016 4:27:05 PM
Your first task isn't actually being cancelled - you're observing that cancellation has been requested, but then you're letting the first task complete normally... which means your "only on cancellation" task is cancelled. If you change... more 10/30/2016 1:07:52 PM
The simplest way is probably to use the null coalescing operator ??. LogoutDate = (A.LogOutTime ?? "Unknown").Split(...)[0] If A.LogOutTime is null, it'll use "Unknown" instead. This is slightly inefficient as it will be calling Split... more 10/30/2016 9:17:31 AM
The documentation for IPAddress.Address says: This property is obsolete. Use GetAddressBytes. So I suggest you do that: public static long CastIp(string ip) { IPAddress address = IPAddress.Parse(ip); byte[] addressBytes =... more 10/29/2016 10:19:14 AM
None of the tasks get ever cancelled when I run the program. That's because you're only ever checking the cancellation token at the start of the task. Once it's got past that first token.IsCancellationRequested check, cancelling the... more 10/28/2016 1:03:12 PM
It sounds like you just want a Func<IEnumerable<ServiceModel>, IEnumerable<ServiceModel>> - in other words, "Given one query, I'll give you another." public IEnumerable<ServiceModel> Get( ... more 10/27/2016 9:35:42 PM
Currently you're looking in the strings "win810Words" and "win7Words". There's an enormous difference between those string values and the values of the variables win810Words and win7Words. So the first change is to use: string[]... more 10/27/2016 4:45:29 PM
generic_foo2() is implemented by the compiler via a state machine. That state machine will be generic in T even though you're not actually using it - so calling GetType() on the instance of the state machine will give a generic type. It... more 10/27/2016 2:58:35 PM
No - just put it in AssemblyInfo.cs as normal. That's still a perfectly fine place to put assembly attributes. If one isn't created for you in the template you're using, just create your own AssemblyInfo.cs file (or any other name, of... more 10/27/2016 1:42:53 PM
Well yes, you're just creating a new anonymous type. It's easy to wrap that in an array though: return Json(new[] { new { stampCode = "666", email = "666_doctor@gmail.com", phone = "+370 640 000000", healthCareProvider =... more 10/27/2016 9:02:10 AM