Browsing 7239 questions and answers with Jon Skeet
The conversion is correct according to the IANA rules. The Europe/Berlin rule starts with this line: Zone Europe/Berlin 0:53:28 - LMT 1893 Apr You started off with 1869-12-31T23:00:00Z, so the local time is... more 5/27/2016 9:34:15 AM
Sounds like you're just looking for this constructor: String text = new String(data, 0, 120, StandardCharsets.UTF_8); (Always specify the encoding explicitly when converting between binary and text forms.) more 5/27/2016 6:31:49 AM
You're not implementing the interface. You're saying that the type argument supplied for the type parameter T must itself implement the interface. That's what the where T part means - it's specifying constraints on T. This means that in... more 5/26/2016 11:22:39 AM
You could just have a constructor with a NodeA parameter: NodeB nodeB = new NodeB(nodeA); ... but having a factory method is also a pretty idiomatic solution. It has various benefits, including being able to have multiple methods with... more 5/26/2016 8:02:54 AM
You can't access a local variable from a different method, no. (Once the method has completed, the local variable doesn't exist any more.) However, you can use the return value from your calc method, and pass that to the printText... more 5/25/2016 10:14:15 PM
No, there's nothing between those two within .NET - if you look at DateTimeFormatInfo you'll see ShortDatePattern and LongDatePattern, but no "medium date pattern". If you know all the cultures you'll need to handle, you could customize... more 5/25/2016 10:12:39 PM
The second way is a compile-time constant, so elsewhere in your code when you refer to the value, it won't actually refer to the field - it will just have the value baked in. Unless you start messing with the field via reflection or... more 5/25/2016 5:04:55 PM
No, it isn't. Not without reflection, which you should avoid. Messing with the underlying char[] in a string via reflection is a recipe for subtle bugs. You can access individual characters in a string using charAt, but if you really need... more 5/25/2016 4:55:16 PM
You're ignoring the return value of Socket.Receive which tells you how many bytes have been read - which is just like ignoring the return value of Stream.Read. So your buffer contains more bytes than you've actually received, and your... more 5/25/2016 4:33:20 PM
That's not overriding anything - you're trying to overload the existing ToString method. It's a good job you're not trying to override anything, as you basically can't do that - you can only override members within a class declaration, and... more 5/25/2016 3:07:28 PM