Browsing 7239 questions and answers with Jon Skeet
The two types represent the same logical signature, but that doesn't mean they're just interchangable. A straight assignment won't work, for example - but you can create a new Func<T, bool> from the Predicate<T, bool>. Sample... more 8/27/2014 4:07:31 PM
If you use my DoubleConverter, you can see the exact value of result: Console.WriteLine(DoubleConverter.ToExactString(result)); That prints: 591.2457499999999299689079634845256805419921875 ... which rounds to 591.2457 when rounded to... more 8/27/2014 3:56:04 PM
Currently, you're assigning a value to a variable, and declaring that your method doesn't return anything. Instead, you should just make it return the result: public int calculate(...) { int x = y+z/2 +i; if(x >= 10) { ... more 8/27/2014 2:28:32 PM
I think it's reasonable for an issue in the machine.config file to mean that an app simply can't run. If your system-wide configuration is broken, you (the owner of that broken configuration) should fix it. Not all failures can be... more 8/27/2014 8:12:35 AM
It's simply because it doesn't need to escape >, ' or ". The quotes would only need to be encoded in an attribute which was opened with the same kind of quote (so foo="single'quote" or bar='double"quote' is fine) and the closing angle... more 8/27/2014 5:53:51 AM
The reason your current code doesn't work is that handler is just a local variable within the constructor. While you could add a public property, if the point is just for external code to be able to get a delegate which calls... more 8/27/2014 5:46:16 AM
To get Assembly.GetType to work, you need to use the CLR name, which includes the generic arity - the number of type parameters it has: Type type = Assembly.GetExecutingAssembly().GetType("Test.TestConsume`1"); That's assuming you need... more 8/26/2014 8:47:15 PM
Actually I should not get 12:00AM any more???? Why not? A DateTime has no notion of whether it's meant to be a date or a date and time, or any sort of string formatting. It's just a point in time (and not even quite that, given the... more 8/26/2014 7:58:05 PM
The problem is that you're using XElement.Parse, so you're parsing the string as an element... so xdoc is already the EncryptionInfoResponse element, which doesn't have any more EncryptionInfoResponse descendants. Options: Use... more 8/26/2014 7:49:57 PM
I think you're looking for JLS section 15.13.3, which includes: If the form is ReferenceType :: [TypeArguments] Identifier, the body of the invocation method similarly has the effect of a method invocation expression for a compile-time... more 8/26/2014 6:20:57 PM