Browsing 7239 questions and answers with Jon Skeet
If you just want to copy the exact binary data, without caring whether it's text or not, you should be using Stream. For example: using (var input = Stream.OpenRead(inputFile)) using (var output = Stream.OpenWrite(outputFile)) { ... more 11/14/2013 2:54:41 PM
In the first version, you're converting your value to a DateTime and then to a string, using the default format for a DateTime value. MySQL is then trying to parse that, and presumably failing. In the second version, you're parsing your... more 11/14/2013 2:50:27 PM
Objects aren't passed at all. For expressions of a reference type (classes, interfaces etc) references are passed - by value by default, but the variables are passed by reference if you use ref. It's important to understand that the... more 11/14/2013 2:34:09 PM
Activator.CreateInstance(string, string) doesn't do what you think it does. The first parameter is the assembly name. The second parameter is the fully-qualified type name. So you should have: string className =... more 11/14/2013 2:10:17 PM
It's fine - assuming nothing's writing to the file at the same time, in which case you may not be able to open the file (or might see partial writes). As per the documentation of File: Any public static (Shared in Visual Basic)... more 11/14/2013 11:28:01 AM
But this method is tedious and I was wondering if there is an easy way out? Not that I'm aware of. But if you find yourself writing the same code multiple times, you may well find that if you extract some helper methods it actually... more 11/14/2013 10:34:11 AM
"Static constructor" is really just C# terminology. In .NET itself, there's a type initializer (as per Type.TypeInitializer). A type can have a type initializer without having a static constructor declared in C# - e.g. for static variable... more 11/14/2013 10:23:35 AM
The problem is that you've imported java.net.Authenticator instead of javax.mail.Authenticator. Look at the types specified in the error message, then look at the parameter types in the documentation for Session.getInstance. more 11/14/2013 10:08:24 AM
Could anyone explain to me why the result in the first example is true? Because StringBuilder overloads Equals: Return Value Type: System.Boolean true if this instance and sb have equal string, Capacity, and MaxCapacity... more 11/14/2013 9:41:19 AM
The problem is your Student constructor. It needs to chain to the CollegeMember constructor, which it should do like this: public Student(String name, int year, String telNumber) { super(name, telNumber); this.year =... more 11/14/2013 6:33:51 AM