Browsing 7239 questions and answers with Jon Skeet
super.type is just referring to the same variable as this.type... there's only one object involved, and therefore one field. When you create an instance of a subclass, it doesn't create two separate objects, one for the superclass and one... more 12/23/2015 8:34:19 AM
Having said that I wouldn't expect that behaviour, I've just noticed that Convert.ToInt32 rounds instead of truncating - so it's behaving exactly as expected. The TotalMinutes property is returning 17.6666 (etc) which is being rounded up... more 12/23/2015 8:30:42 AM
I suspect it's as simple as setting the DataSource: view.DataSource = characters; Depending on what LINQ to CSV does, you may want to pull everything into a List<T> first: var characters = cc.Read<Character>(file,... more 12/23/2015 7:09:44 AM
As mentioned in comments, I'd just convert to a string: String text = new String(raw.toByteArray(), encoding); byte[] utf8 = text.getBytes(StandardCharsets.UTF_8); However, if that's not feasible (for some unspecified reason...) what... more 12/22/2015 10:41:40 AM
I suspect you're looking for the null-coalescing operator here to provide a default value if the existing value is a null reference. // Names changed to look more conventional people.Add(new Person { Id = (int) item["ID"], Name = (string)... more 12/18/2015 12:23:05 PM
This has nothing to do with BinaryWriter, really - it's the File.OpenWrite call, whose documentation includes: The OpenWrite method opens a file if one already exists for the file path, or creates a new file if one does not exist. For... more 12/18/2015 12:06:31 PM
The conditional operator isn't a "short if form"... it's an operator, which evaluates either the third operand or the second operand based on the evaluation of the first operand. The result of the whole expression is the result of... more 12/18/2015 9:16:30 AM
Okay, I think I see at least one potential problem (and definitely code to be avoided)... Every time you evaluate the AllDatabases property, you add all the files to the collection. Property fetches shouldn't do that - they shouldn't... more 12/18/2015 9:12:21 AM
Integer.toBinaryString treats the int value as an unsigned integer, as per the documentation: Returns a string representation of the integer argument as an unsigned integer in base 2. The unsigned integer value is the argument... more 12/18/2015 7:58:42 AM
There are two problems here: Your using directive tries to pull in a namespace ending in XDocument. You want using System.Xml.Linq; which is the namespace containing XDocument You need to specify the framework assemblies you need for the... more 12/17/2015 3:54:40 PM