Browsing 7239 questions and answers with Jon Skeet
It sounds like you just want to implement IEqualityComparer<ActivitiesActivity>: public class ActivitiesActivityEqualityComparer : IEqualityComparer<ActivitiesActivity> { public bool Equals(ActivitiesActivity x,... more 3/19/2015 1:56:58 PM
Yes - just create an appropriate formatter: DateTimeFormatter formatter = DateTimeFormat .forPattern("MMMM yyyy") .withLocale(LOCALE); String text = formatter.print(myDate); more 3/19/2015 1:30:42 PM
I understand that when an async method hits an await expression, the method returns immediately and at some point in the future the await expression returns and the method continues to execute. Yes, if the awaitable hasn't already... more 3/19/2015 11:39:46 AM
No, basically that doesn't implement the method. With the declarations you've got, I should be able to write: abs x = new con1(); abs y = new con2(); x.foo(y); It sounds like you want: public abstract class Abstract<T extends... more 3/19/2015 11:35:25 AM
No, this isn't possible - it would break the whole point of polymorphism. In particular, imagine you didn't use var, but used the types explicitly: Sub1 s2 = new Sub2(); s2.Test(); That has to compile: The first line has to compile... more 3/19/2015 10:54:12 AM
I would normally format that like this: char statusCode = AutoFFSuccess ? ActSuccess ? 'P' : 'W' : FUPSuccess ? ActSuccess ? 'F' : 'G' : 'E' Or: char... more 3/19/2015 10:20:46 AM
The problem is with this line: new FileWriter(hi).append(hello); You're not closing the writer, which means: The file handle is potentially still open, which could cause problems when you try to write to it You're not flushing the... more 3/19/2015 9:40:36 AM
Your comparer is broken - two objects which are equal don't necessarily return the same hash code. Equality and hash code generation have to be consistent with each other. You can fix this using something like: public int... more 3/19/2015 8:14:15 AM
However, when I changed tile (1,1) to ON on HashMap A , it updated HashMap B as well. When you write: Tile t2 = A.get(new Point(1,1)); t2.setS("ON"); you're not changing either of the maps. The maps just have references to Point... more 3/19/2015 7:59:55 AM
I'd usually go with [ExpectedException(typeof(MyException)] I suggest you don't do that. You haven't told us which unit test framework you're using, but these days most provide something like: Assert.Throws<MyException>(()... more 3/19/2015 7:34:12 AM