Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bad practice. Or Not ?
Message
General information
Forum:
ASP.NET
Category:
Class design
Environment versions
Environment:
C# 4.0
Miscellaneous
Thread ID:
01492859
Message ID:
01493103
Views:
53
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform