I hope extension method could not access the private or protected members of the original class. From C# 3.0 onwards, extension method offers a way to attach new methods to object types, even the original type is sealed or immutable.
To do so, the extension method must be defined in a static class with this modifier in front of its first parameter. The first parameter is actually the reference to the instance of the original object type, which will be using this extension method. Just be careful, extension method is always gonna be a static function, so everything is within extension method is not instance-based, it is type-based instead.
The most exciting thing about this world is its ever changing quality.
Sunday, October 26, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment