Browsing 7239 questions and answers with Jon Skeet
You can make this code considerably simpler by making some assumptions: The first day of the month is always day 1 The minimum hour will always be 0 ... etc You can then find the last millisecond of the month by adding one month and... more 2/4/2014 9:03:50 PM
You don't generally create XmlNodeList instances yourself. Do you really need one though? If you just need to iterate over the nodes, just assign it to an IEnumerable<XmlElement>: IEnumerable<XmlElement> abTestDocx =... more 2/4/2014 7:56:38 PM
Yes, you can represent all Unicode characters in C#, including in string literals. There isn't so much a list of "special" characters as a whole range of charts to look at. Find the character you're interested in is U+256A, as can be seen... more 2/4/2014 7:49:09 PM
You'll need to use reflection. For example: WaitCallback callback = (WaitCallback) Delegate.CreateDelegate( typeof(WaitCallback), this, myFunction); ThreadPool.QueueUserWorkItem(callback); To use a method in a different class,... more 2/4/2014 3:56:53 PM
It sounds like you should might want to make Paginate still take an IOrderedQueryable<T> to validate at compile-time that you've started with something that's ordered - but you don't then need to assign back to the same variable. For... more 2/4/2014 11:59:46 AM
How can I define that parameter? You can't, basically. Not in a constructor. The closest you could come to would be to create a static generic method returning a B: public static B CreateInstance<T>(T item) where T : A,... more 2/4/2014 9:59:04 AM
If you're using C# 5, the simplest approach is to make the method async: private async void RunProgramClick(object sender, RoutedEventArgs e) { // Reverse the logic to reduce nesting and use "early out" if (comboBox1.Text !=... more 2/4/2014 8:50:46 AM
Your path contains backslashes, and those are being escaped by toJson(). When you deserialize at the other end, you'll end up with a string of \/folder1\/folder2 via normal JSON unescaping. I don't see this as an issue: the aim of... more 2/4/2014 8:38:39 AM
An XElement has a name, represented as an XName. That XName may or may not have a namespace associated with it. If it doesn't, the XName.Namespace property will return XNamespace.None. An XName is a fully-qualified name, basically -... more 2/3/2014 2:17:02 PM
Shouldn't they be the same? No - or at least, not necessarily. This is basically the same as a List<T>'s capacity vs its count (or StringBuilder for that matter). The idea is that in order to minimize the number of times you... more 2/3/2014 1:56:05 PM