Browsing 7239 questions and answers with Jon Skeet
No, you don't get to decide what parameters the event handler has. Bear in mind that there's already code in the system which is going to call your event handler... how would you expect it to construct an instance of your... more 4/9/2016 10:48:16 AM
We can't really tell what's wrong with your current query in terms of compilation without knowing the types involved, but it wouldn't be equivalent to your original SQL anyway, as you want left outer joins. I suspect you want something... more 4/8/2016 2:57:12 PM
No - the documentation explains this: Extensions do not actually modify classes they extend. By defining an extension, you do not insert new members into a class, but merely make new functions callable with the dot-notation on... more 4/8/2016 2:40:10 PM
It's just assigning the same value twice - once to myVar and once to myComplexType.myType. It's equivalent to var tmp = new MyType(); myVar = tmp; myComplexType.myType = tmp; (In some complex cases there can be type conversions going... more 4/8/2016 7:08:05 AM
Your replaceAll approach was nearly right - it's just that * matches 0 occurrences. You want + to mean "one or more". "aaaaa".replaceAll("a+","a") // Returns "a" more 4/7/2016 11:12:10 AM
Are they any downsides to writing my code in C#6.0 (or whatever the latest C# version is in the future) but compiling it against the .NET 2.0 framework (or some other version of .NET which is different than the C# version that it was... more 4/6/2016 2:44:26 PM
Will ListEqualByComparer.TryGetOrCreate always be called before EnumerableEqualByComparer.TryGetOrCreate? Yes, and as || is short-circuiting, the second call will only be made if the first call returns false. From the C# 5... more 4/6/2016 10:13:57 AM
As you've said you can use LINQ to XML, I'd use something like this: public List<XElement> FindElementsByName(XDocument doc, string name) { return doc.Descendants() .Where(x => (string) x.Attribute("name") ==... more 4/6/2016 9:14:18 AM
Let's just look at your 1915 example. The value -1712458800000 as millis-since-the-unix-epoch is 1915-09-26T21:00:00Z - in other words, exactly 9pm UTC. Now back in 1915, the UTC offset in Jerusalem was +2:20:40, which is why you see "Sep... more 4/6/2016 6:21:26 AM
Yup, you just need Any to see if "any" of the target strings are contained in the array element: List<int> index = stringArray .Select((Value, Index) => new { Value, Index }) .Where(pair => searchArray.Any(target =>... more 4/5/2016 9:11:16 PM