Browsing 7239 questions and answers with Jon Skeet
Firstly, you're looking in Enumerable for methods - that's not a good idea if you're trying to work with expression trees. You should be looking in Queryable. Next, you need to understand that the Sum method is overloaded - and there are... more 1/29/2015 8:41:45 PM
You need "\r\n" for a line break in Windows controls, because that's the normal line break combination for Windows. (Line breaks are the bane of programmers everywhere. Different operating systems have different character sequences that... more 1/29/2015 7:29:43 PM
Is there any way in C# to have a generic type that is always the implementing type in an interface? No. The answers given so far don't satisfy this, for two reasons: You can always implement an interface with a different... more 1/29/2015 7:17:37 PM
Just select the entries, filter based on the values, then project to the keys: var keys = dic.Where(entry => entry.Value > 5) .Select(entry => entry.Key); Note that this approach is fine for any... more 1/29/2015 6:46:27 PM
You need to add a reference to the System.Xml assembly (not a using directive for the System.Xml namespace). Do that in Solution Explorer - it's not a code issue. This is unfortunate, but as far as I can tell it's an unavoidable... more 1/29/2015 5:47:04 PM
You've got at least four problems: You're declaring the counter variable as a local variable inside your method. I suspect you meant to declare a field somewhere - or return a reference from the method, and assign it to an instance... more 1/29/2015 3:45:41 PM
To get the current date, you need to specify which time zone you're in. So given a clock and a time zone, you'd use: LocalDate today = clock.Now.InZone(zone).Date; While you can use SystemClock.Instance, it's generally better to inject... more 1/29/2015 3:31:14 PM
Although an int is an IComparable, an int[] isn't an IComparable[]. Imagine if it were: int[] x = new int[10]; IComparable[] y = x; y[0] = "hello"; That would be trying to store a reference in an int[]. Badness. Basically, value-type... more 1/29/2015 3:21:42 PM
Neither your C# code nor your Java code are good ways to convert a hash to a string. I strongly suspect you've got the same bytes in both cases, but you're converting them to strings differently. Your C# code is just converting each byte... more 1/29/2015 1:59:33 PM
Based on the exception and the example in the documentation, I suspect you need to format this as a US short date. The simplest way of doing this is probably just to use the invariant culture. For example: metadata.DateTaken =... more 1/29/2015 1:47:50 PM