Browsing 7239 questions and answers with Jon Skeet
Convert.ChangeType(object, Type) uses the thread's current culture for conversion. It sounds like you want the invariant culture, so you should use Convert.ChangeType(object, Type, IFormatProvider): cell.Value =... more 11/21/2016 9:01:49 AM
You're trying to access an instance member within an auto-implemented property initializer. That's like trying to do so in a field initializer. Basically, you can't reference this even implicitly in initializers, not even within lambda... more 11/21/2016 8:28:03 AM
You're starting the asynchronous operation, but you're not waiting for it to finish - when you've printed asyn demo there's nothing else keeping a non-daemon thread alive, so the process terminates. Just wait for the... more 11/21/2016 8:13:40 AM
You're declaring directions within the Start method, so it's a local variable. You should declare it as a field - and I'd make it a static field, as you don't need a different dictionary for each instance. You can use a collection... more 11/19/2016 9:23:04 AM
No, you can't do that - if you call new Foo(), that will always create an instance of Foo, never of a subclass. Instead, create a static factory method in Category: public static Category CreateCategory(string line) { if (line ==... more 11/18/2016 2:12:51 PM
ToArray always creates a copy. Your extension method does not behave the same way. Note that there are subtleties here around types as well. Consider this code: string[] x = { "a", "b" }; object[] y =... more 11/18/2016 9:27:55 AM
The attributes are lower-cased automatically. I found this out by putting self.log(attributes); into the script. So if you change your script to use propn instead of propN it works: project.setProperty(attributes.get("propn"),... more 11/17/2016 6:32:41 PM
Dictionary<,> itself doesn't provide a good way of doing this - because updating the value associated with a key counts as a change that invalidates any iterator. ConcurrentDictionary<,> does allow this though, and even has an... more 11/17/2016 3:10:57 PM
Well, you can use a using alias directive: #if __MonoCS__ using SQLiteConnection = Foo.Bar.SqliteConnection; #endif Then you can use SQLiteConnection everywhere within the same file. You may want to use the adapter pattern to put this... more 11/16/2016 4:10:23 PM
Well, it sounds like you want to: Filter by country Group by birth date Order the groups in descending order Take the first group So (assuming the property names have been fixed to follow conventions): var query = db.People ... more 11/16/2016 9:30:31 AM