function, operator, or method?
If the class is sealed, you are kinda screwed. Use a bridge or adapter pattern. If the class is not sealed, you can inherit and use a strategy pattern. You can overload operators in C#. You can declare both explicit and implicit type conversions. You can even cause overloaded operators to return some other type. For example causing == to return a non-bool type seems stupid, but in certain cases (see NHibernate Query Generator) it makes for very readable code.
Related Questions
- How do I control a communication method to control the voice volume? What will happen to the switch and communication function operated in the COMBO example?
- Is there any method to audit contract data entered by another operator to ensure accuracy?
- Keeping patient satisfaction (function) as top priority, which method is best?