Browsing 7239 questions and answers with Jon Skeet
Presumably the ? after the event name is a check if the handler is null? Yes. It's the null conditional operator, introduced in C# 6. It's useful in all kinds of ways. I've used the first example for years and realize it prevents... more 5/6/2016 3:46:29 PM
Is there a performance benefit to changing these to static classes? Yes - you won't be constructing a load of pointless objects which the GC then has to collect. Is that significant in your application? Hard to tell. More... more 5/6/2016 9:48:00 AM
This is an undocumented (as far as I'm aware) optimization in the CLR. It's very odd, but yes: the new operator is returning the same reference from two calls. It appears to be implemented in CoreCLR as well on Linux (and even on... more 5/6/2016 9:33:06 AM
You're trying to take the text of the file, and then load it as if that were another filename. In other words, you're asking to read a file called "Auto 2017 Mech 2056 CSE 2016" including line breaks. That file doesn't exist, does it? Get... more 5/6/2016 5:53:12 AM
The problem is that you're calling Expression.Parameter twice, so you've got two different parameter expressions. They don't bind by name, unfortunately. So the solution is simply to use multiple statements, creating a ParameterExpression... more 5/5/2016 3:27:45 PM
So what's the real type of x => x + x; It doesn't have one. A lambda expression is implicitly convertible into compatible delegate types and expression tree types (with some restrictions) but that decision is made at compile-time,... more 5/5/2016 10:33:44 AM
so my question how can I write and read (using BinaryReader) single bit to/from MemoryStream ? You can't. The smallest "unit" of data in a stream is a byte. If you've got some other byte of which you're only using 7 bits, you could... more 5/5/2016 5:46:07 AM
When you call f.Equals(s) you're really doing: f.Equals((object)s) ... because Enum and ValueType don't overload Equals. So basically you need a conversion in there - and you can be clearer about the Equals method you're calling,... more 5/4/2016 10:50:37 AM
The character "+" is replacing by white space. Yes, it would be - because that's what URL decoding is meant to do for query parameters. When you URL-encode a space in a query parameter, you get a + in the resulting URL, so... more 5/3/2016 12:52:20 PM
Your current code doesn't create any objects of type checker - it just creates an array which is capable of holding references to objects of type checker. Initially every element in the array has a value of null. It's important to... more 5/2/2016 7:13:52 AM