Browsing 7239 questions and answers with Jon Skeet
Somehow after the for loop the values of the object.num = 1 no matter what, even though they are never set to 1. Yes "they" are - "they're" set to 1 in the last iteration of this loop: for(var temp = n; temp > 0; temp--) { ... more 11/15/2014 9:05:35 AM
It sounds like you should be using a DateTime column in the database, at which point there's no need for integers or strings: var today = DateTime.Today; // Or maybe use DateTime.Now // Use parameterized SQL rather than string... more 11/15/2014 8:41:02 AM
The error is exactly what the compiler says it is - you've got a final field, but nothing setting it. Final fields need to be assigned to exactly once. You're not assigning to it at all. We don't know what the field is meant to represent... more 11/14/2014 5:21:57 PM
The problem (or at least one problem) is that you're trying to use a parameter for a column name. You can't do that - only values can be parameterized. Column and table names have to be part of the SQL itself. So for example, this: case... more 11/14/2014 3:12:05 PM
You shouldn't specify your own format - you should instead tell the XML serializer that the value is just meant to be a date, using: [XmlElement(DataType="date")] Then force the use of XML serializer with... more 11/14/2014 11:25:40 AM
The compiler is creating an extra type which stores the local variable. Both the method and the lambda expression then use an instance of that extra type. The code would be something like this: public MainWindow() { CunningCapture... more 11/14/2014 11:14:35 AM
You're disposing of the SqlConection when you dispose of the Test - but you're then trying to use it again. The best approach is almost always to create a new SqlConnection each time you need one - and dispose of it as soon as you're... more 11/14/2014 7:47:20 AM
Look at this: string newWord = word.Replace(word[k - 1], '.'); You're always replacing a single character from word... but word itself doesn't change, so on the next iteration the replacement has "gone". You could use: word =... more 11/13/2014 10:05:42 PM
It's because you're trying to change the value of an anonymous type - there's not such thing as a var type; that's just telling the compiler to infer the type of the variable from the expression on the right-hand side of the assignment... more 11/13/2014 7:21:59 PM
Does anyone have any ideas about what could be going on? Yup - primary constructors have been removed from the plans for C# 6. They may well make an appearance in some form in a later version, but they're not in C# 6 any more. See... more 11/13/2014 6:22:26 PM