Browsing 7239 questions and answers with Jon Skeet
Your approach to equality fundamentally breaks the specifications in Object.Equals. In particular, consider: var x = new ResourceInfo { Id = null, Uri = "a" }; var y = new ResourceInfo { Id = "yz", Uri = "a" }; var z = new ResourceInfo {... more 7/14/2014 9:08:44 AM
I strongly suspect that the hex conversion you're using in the application is failing if the leading nybble of a byte is 0. This is probably because you've got hex conversion code within the application itself, rather than using a standard... more 7/14/2014 8:25:36 AM
It's unclear exactly what code you meant, as the code you've given doesn't compile for a couple of reasons. Most importantly, did you actually mean to call Init from ClassBase rather than from Class_A? If not, it seems pointless making... more 7/14/2014 6:47:46 AM
(You may want to consider storing the values in your database as integers instead of as text. There are pros and cons here, so I'll just leave that as a thought which is somewhat separate to your actual question.) The parsing is... more 7/13/2014 8:11:43 PM
You can't access fields before you call the superclass constructor - basically the very first thing that any constructor does is invoke a superclass constructor. The only thing you get to do is evaluate arguments to call that superclass... more 7/13/2014 7:53:44 PM
This line: System.out.println("p is " + p); uses string concatenation, which is specified in section 15.18.1 of the JLS, starting with: If only one operand expression is of type String, then string conversion (ยง5.1.11) is performed... more 7/13/2014 7:10:42 AM
how can I tell him that the date string provided is in the UTC format and not in the local timezone format? Specify a DateTimeStyles value of AssumeUniversal in the call. That tells the parsing code what to do. For example: // null... more 7/12/2014 5:39:27 PM
No, they both compile to exactly the same IL. It's easier to see if you actually give the lambda body something that depends on state - otherwise the compiler caches a single delegate instance for each lambda. But for example: using... more 7/11/2014 8:24:59 PM
Is there some type of way to break or force a return for the entire method? No. At least, not unless you throw an exception. Basically, that's not what forEach is meant for. You could write a method which accepted a function which... more 7/11/2014 7:09:40 PM
You need to understand that xmlns is a very special attribute. Basically, the xmlns="" is so that your Customer element is in the "unnamed" namespace, rather than the http://othernamespace namespace (and likewise for other elements which... more 7/11/2014 1:53:51 PM