Satyajit
Satyajit

Reputation: 2061

Similar to Extension Methods Functionality - Can we extend properties

Extension methods are a great way to extend the functionality of a type. Are there any ways similar to this which can be used to extend properties of a class without inheriting a new class.

Upvotes: 1

Views: 101

Answers (1)

Salah Akbari
Salah Akbari

Reputation: 39946

No extension properties do not exist.

You can't do it via properties without inheriting a new class. There are only extension methods, not extension properties (it may be added at a future date). If you don't want to alter the original class you should inherit from the original class and then add your properties to the derived class.

Upvotes: 3

Related Questions