Browsing 7239 questions and answers with Jon Skeet
My guess is that you're using Windows. Write \r\n instead of \n\r - as \r\n is the linebreak on Windows. I'm sure you'll find that the characters you're writing into the file are there - but you need to understand that different platforms... more 11/5/2013 7:24:22 PM
If you're trying to get groups where any users are active, you want: var groups = Groups.Where(g => g.Users.Any(u => u.Active)); If you want groups where all the users are active, you want: var groups = Groups.Where(g =>... more 11/5/2013 6:16:58 PM
When I try the following, function2 does not recognise the variable variable1. Should this be the case? Yes. It's a local variable - local to the method in which it's declared. That method could be executing several times within the... more 11/5/2013 5:45:00 PM
When I run the program for a second time and check the table, it's rows double - i,e it now has 100 rows. Well yes, it would. You've said to create the table if it doesn't exist, and then you're inserting a bunch of data, without... more 11/5/2013 4:19:55 PM
Yes, sort of. You basically create a new type to encapsulate all the parameters - or maybe just some of them. Now you can create a builder and then an immutable version of the type - or you could just allow the "uber-parameter" type to be... more 11/5/2013 4:11:16 PM
You haven't created a customerId property. You've created a MemberUserId property. That said, your code would still be invalid as you've declared the basePage local variable, but haven't assigned a value to it. Are you sure you don't just... more 11/5/2013 1:32:19 PM
Yes, so you need to take account of that by checking for the row and column values being 0 or the height/width. If you're just adding up values, you may find it easiest to have a method which just returns the value in the array, or 0 if... more 11/5/2013 8:03:30 AM
Presumably the UTF-8 representation of the text in textBox2 is fewer than 4 bytes long. BitConverter.ToInt32 requires 4 bytes of data to work with. It's not clear what you're trying to achieve, by the way - but using BitConverter.ToInt32... more 11/5/2013 7:56:50 AM
(Answer written before the restriction against parameterized SQL was added.) How should I specify the value of Datetime? With parameterized SQL, just like other values. using (SqlCommand command = new SqlCommand("StoredProcName",... more 11/5/2013 7:26:23 AM
Your A constructor needs to chain to a B constructor using super. At the moment the only constructor in B takes an int parameters, so you need to specify one, e.g. public A(int x) { super(x); // Calls the B(number) constructor ... more 11/4/2013 5:22:51 PM