Browsing 7239 questions and answers with Jon Skeet
It's not entirely clear why you need to do this binding yourself (when WPF does a lot of this for you), but this might work: foreach (object item in ItemsSource) { var property = item.GetType().GetProperty(DisplayMemberPath); var... more 12/24/2013 10:38:38 AM
Can't the compiler see there are no other options for VeryBool? Nope, because there are. For example, I could call: VeryBoolToBool((VeryBool) 5); Enums in C# are not limited sets of values. They're effectively named numbers, with... more 12/24/2013 10:20:08 AM
You're currently returning a java.util.Date - that doesn't have a time zone. It's just an instant in time. It's not in your time zone, or some other time zone - it's just an instant. When you call toString(), that will give you a textual... more 12/23/2013 12:18:15 PM
I can't reproduce the problem on my laptop, but your DoSomething method doesn't use any fields within the object. That means that the object can be finalized even while DoSomething is running. If you change your code to: class... more 12/22/2013 4:50:48 PM
Well, you're getting an EOFException because you're reading forever - you never change the value of done. The reason it's appearing in the middle of the text instead of at the end is that you're using System.err to print in the... more 12/22/2013 10:11:04 AM
No, attributes aren't part of the contract of the interface, in terms of what implementations must provide. For this sort of thing, I usually just add a unit test which uses reflection to find all implementations and validates it that... more 12/21/2013 11:38:46 AM
If you want to throw your own exception, just create your own class with similar methods to the ones in Preconditions. Each of those methods is extremely simple - adding some sort of "plug-in" ability to allow the exception class to be... more 12/20/2013 3:39:19 PM
You don't have javac in your path. Setting the JAVA_HOME and/or JRE_HOME environment variables (which aren't needed any more, for the most part) does nothing to the PATH which the command shell uses to find executables. Put the relevant... more 12/20/2013 3:01:24 PM
Why doesn't this work Two reasons: You're trying to use var without specifying an initial value. You can't do that - the compiler can't infer the type. You're trying to read from the model variable when it may not be initialized -... more 12/20/2013 1:40:41 PM
My guess is that you've implemented an overload like this: public bool Equals(DataEntity entity) That will not be called by Contains. However, if you override the Equals(object) method declared in System.Object, that will be... more 12/20/2013 1:09:34 PM