Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bad practice. Or Not ?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Versions des environnements
Environment:
C# 4.0
Divers
Thread ID:
01492859
Message ID:
01493103
Vues:
54
>Hi,
>Given:
public class A {}
>public class B
>{
>    public static implicit operator B(A a) { return new B(); }
>    public static implicit operator C(B b) { return new C(); }
>}
>public class C {}
Would you find a statement like this too opaque:
C c = (B)new A();
Yes (assuming this convention isn't used a lot in the code). I wouldn't have a clue as to why that was working (and I'd probably be annoyed that had to dig through the class to figure out what it was doing/why it worked). But if it's used a lot in the code and made the overall code more readable, then all is forgiven <g>
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform