Overload an existing class
Visual Basic
2
Posts
2
Posters
0
Views
1
Watching
-
Can I overload the System.DateTimeOffset class so that I can write either: dim d = now.date 'existing or dim p = now.mynewproperty 'overloaded by me Thanks
-
Can I overload the System.DateTimeOffset class so that I can write either: dim d = now.date 'existing or dim p = now.mynewproperty 'overloaded by me Thanks
You can derive a class from any class you like. I believe you can also use extension methods to add a method to a class, but I've never done that. To add - you'd need to override the Now property to return an instance of your new class, if you wanted to add a property to the Now property.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.