If you can access the data in the appropriate class and can use methods instead of properties, check out the extension methods introduced in C # 3.0. From this article, an extension method is added here, added to the (private, non-mutable) String class:
public static class MyExtensions { public static int WordCount(this String str) { return str.Split(new char[] { ' ', '.', '?' }, StringSplitOptions.RemoveEmptyEntries).Length; } }
From horse mouth , expansion properties are possible in a future version of C #.
This will not help you if you need to access private fields or methods. In this case, you can think about it, but I would advise you to stay away from this, if it is really necessary - sometimes it can be messy.
source share