How to create an extension method for a class in C #?

I would like to write an extension method for a string that appears as a static method in System.String - I could not do this.

Is it possible? If so, how? Thank!

+3
source share
1 answer

It's impossible. Extension methods allow you to add what looks like instance methods rather than static methods.

+9
source

Source: https://habr.com/ru/post/1699308/


All Articles