Browsing 7239 questions and answers with Jon Skeet
I haven't used the library myself, but it seems reasonably clear why your usage would fail: your code for the first statement is equivalent to: Operation op = new Operation("" , "."); verifyException(op,... more 4/27/2014 2:55:01 PM
The first line compiles because all arrays implement Serializable. From the JLS section 10.8: Although an array type is not a class, the Class object of every array acts as if: The direct superclass of every array type is... more 4/27/2014 11:21:42 AM
SolidColorBrush is a dependency object - and you're creating it in the non-UI thread, then trying to use it in the UI thread. Try this instead: Action action = () => { SolidColorBrush scb = new SolidColorBrush(Color.FromRgb(21, 21,... more 4/27/2014 6:38:58 AM
Your SQL will look something like: UPDATE VolunteerDetailsSET FirstName=Foo, LastName='Bar' WHERE VolsID=10 Three problems with this: You have no space between VolunteerDetails and SET You have no apostrophes around the first name to... more 4/26/2014 3:56:40 PM
One option is to use an expression tree: var name = ExpressionTrees.GetPropertyName<MyClass, int>(x => x.MyProperty); ... public static class ExpressionTrees { public static string GetPropertyName<TSource, TTarget> ... more 4/26/2014 7:59:41 AM
Either you need to use a method which uses a predicate indicating whether to keep going (so it has the break instead) or you need to throw an exception - which is a very ugly approach, of course. So you could write a forEachConditional... more 4/26/2014 7:49:19 AM
You'd need to implement a IEqualityComparer<List<T>>, which you can then pass into GroupBy. For example: public class ListEqualityComparer<T> : IEqualityComparer<List<T>> { public bool... more 4/26/2014 7:36:15 AM
It's somewhat unclear to me what you're trying to do. But if the file is within a jar file, FileReader isn't going to work anyway - you don't have a file as far as the operating system is concerned. You should just use getResourceAsStream,... more 4/25/2014 4:44:07 PM
There's no general way to do this - but if you're only bothered by the specific issue of foreach, then there are two options: Start using a C# 5 compiler (you don't need to target .NET 4.5 or anything like that). The rules around... more 4/25/2014 3:02:10 PM
You're getting an overflow exception because you're operating in a checked context, apparently. You can get around that by putting the code in an unchecked context - or just by making sure you don't perform the cast back to byte on a... more 4/25/2014 2:38:31 PM