Browsing 7239 questions and answers with Jon Skeet
FileWriter is a Writer. It's about writing text - and it happens to be writing it to a file. It does that by holding a reference to a FileOutputStream, which is created in the FileWriter constructor and passed to the superclass... more 3/27/2016 5:51:58 PM
You can't - because type constraints are designed to be verifiable by the compiler, whereas clearly typeList.Contains(typeof(T)) is only checkable at execution time. The simplest approach is probably just to validate it as a precondition... more 3/27/2016 4:58:50 AM
So in the Car's getCar() method, how can I tell whether the method call was sent to the class Ferrari, as opposed to the class, Car You can't. (I thought javac used to generate the same bytecode for both calls - it now doesn't, but I... more 3/24/2016 8:56:56 PM
No, there's nothing wrong with the encoding - there is no encoding in a byte[]. They're just bytes. It's just a matter of == for arrays performing a reference comparison. You could use SequenceEqual to compare the arrays: public static... more 3/24/2016 8:28:07 PM
You have zero-width spaces (U+200B) at the start of some of your strings. For example, copy this: {"​Drop card", Drop}, into the Unicode Explorer here, and you'll see something like this: Now, we don't know where that character came... more 3/24/2016 4:32:33 PM
What is wrong with my code that won't allow me to pass the test? Before doing anything else, you should consider how you could have worked out what was wrong for your code to start with. Did you debug through it? At what point did it... more 3/24/2016 7:18:00 AM
Well you could use reflection: public static string GetJurisdictionCode(string jurisdiction) { return typeof(JurisdictionList) .GetTypeInfo() .DeclaredFields .Where(f => (string) f.GetValue(null) ==... more 3/24/2016 6:55:50 AM
Well, in the "regular" .NET framework, you could use Delegate.GetInvocationList. For example, to combine that with LINQ: // Note: do all of this after checking that unitSpawn is non-null... var results = unitSpawn.GetInvocationList() ... more 3/23/2016 5:07:23 PM
If soapObject.byteArray is expecting a byte array, I'd expect to just be able to give it the array - let the proxy perform the encoding in base64. So: $soapObject.byteArray = content No need for base64String at all. more 3/23/2016 3:38:40 PM
Console.Read() generally only returns when the user has pressed return - at which point the carriage return and line feed will also be returned by subsequent calls to Console.Read(). You can validate that by logging (or examining in the... more 3/23/2016 3:18:08 PM