Top sites: Latest tv shows.
Mapload my website. It is what it is) I just happened to have found one.
It is the best, it the best of all the lights.
On T-Mobile, read customer reviews, get free rfid tags, and more.
Most recently, the U. This is our first book.
50,000 People died as a result of this decision.
Discussion in ‘Modest’ forum starts at: CTS Moden are all white; CTS Unions are all black. Tags: Sabado, 2015-07-22. Type your URL for the external link here. I know this is a long topic and hopefully in the near future, I’ll find the time to read all of this at the same time, but until then I’ll wait and hope it all makes sense to me.Q:
Can a collection have both a custom equality (default) and an override?
I've implemented a wrapper class that wraps objects of a common type in this way:
public class MyWrapper {
private T wrapped;
public MyWrapper(T wrapped) { this.wrapped = wrapped; }
public override int GetHashCode() {... }
public override bool Equals(object other) {... }
public override string ToString() {... }
}
This works fine for my purposes. But for my own learning, I want to implement both the implicit and explicit Equals and GetHashCode. Explicit, as you can imagine, would be preferable. And I want to have it so that the behavior of the Equals override would not change the behavior of the default equals for T. In other words, the two must have the same result.
Is there any way to do this?
A:
The short answer is yes, but it's usually not worth the trouble.
If you are relying on that, then it means that your class has effectively become its own equality comparison, rather than the property of a class.
The only time I have ever found it useful is if I have some other class with an equality comparison in a base class, which makes the fact that this implementation is the default for T rather a nuisance. In that case, I override it, and the
Related links:
Comments