Browsing 7239 questions and answers with Jon Skeet
If you're definitely using Noda Time and want a ZonedDateTime, you could "tell" Noda Time that you've really got a UTC value, then convert it: var zoned = LocalDateTime.FromDateTime(utcDate) ... more 1/15/2017 2:40:50 PM
You could use a dictionary from the type to a delegate to call when you receive a package of that type. So for example: class PackageReader { private static readonly Dictionary<Type, Action<AbstractPackage>>... more 1/14/2017 1:17:13 AM
No, they're not namespaces. A namespace is something like System, System.IO or System.Collections.Generic. The libraries contain types that are in namespaces, but the libraries aren't namespaces themselves. more 1/13/2017 12:33:32 PM
Is the effect of such operation immediately visible across the application or only after the method returns? It's immediately visible - because basically, what you end up passing is the variable itself, not the variable's value.... more 1/11/2017 4:42:04 PM
My question is: what is async really doing when there isn't an await? In terms of observable behaviour: The code will still run synchronously, as the warning says The result (including any exception thrown) will be wrapped up in a... more 1/11/2017 2:44:56 PM
Three options for you to consider, depending on what you're actually trying to achieve: Use overloads public void DoSomething(int s) { ... } public void DoSomething(string s) { ... } This will only accept int and string - which could... more 1/10/2017 2:17:07 PM
You're confusing a namespace alias (which you want to be xdt) with the namespace URI. You want to put the elements in the right namespace (by URI) but specify an xmlns attribute in the root element with the alias you want: using... more 1/9/2017 10:16:44 PM
Other answers have explained why Concat isn't helping you - but they've all kept your original loop. There's no need for that - LINQ has you covered: List<Student> finalList = dictOfList.OrderBy(k => k.Key) ... more 1/9/2017 8:50:36 AM
You just need to add the class constraint to TLine: class Matrix<TLine> where TLine : class, ILine This will ensure that TLine is a reference type - which then allows generic variance to work. Variance only works for reference... more 1/6/2017 10:45:05 AM
It sounds like you just want a mix of Skip and Take, filtering with Where: var query = list.Skip(index - 3) // Start at appropriate index .Take(3) // Only consider the next three values ... more 1/6/2017 10:04:56 AM