on-internet
← Community

Reflection access to static extension methods and extension properties

Stack Overflow ·

With the new C# 14 feature of static extension methods and extension properties, how to find and use them via reflection? (From the docs) public static class MyExtensions { extension(string str) { public int WordCount() => str.Split([' ', '.', '?'], StringSplitOptions.RemoveEmptyEntries).Length; } } It is not clear how this "extension" block is accessible here and the msdn doc does not seem to talk about that. I have seen that typeof(MyExtensions) has a method get_WordCount, which kind of works, but here I have nothing but a naming convention that tells me that this really is a property. Is th

Comments

Sign in or sign up to comment and upvote.

No comments yet.