The methods extension , extension methods English, is one of the innovations of the last version. Net Framework. As its name suggests, these methods allow extend the functionality of a class without having the source code with it.
In VB.NET you use a module to write the methods extension , and this is precisely the cause of many negative criticisms regarding the use of these methods.
Inside the module will need to define the methods and include the signature attribute that is what will define our approach as a method of extension.
Then you need to have at least one parameter in the signature, we will indicate the class that this method will extend, for example, do a method to extend the class String:
Then we can call our method as an instance method:
In signing the method is the parameter that defines the class that stretches, but when it comes to call it, this parameter is not used, now let our method of outreach to accept a parameter to be used for replacing the character @ .
Now if, when we will have to call to pass the parameter Replacement:
The following method extends the class
System.Windows.Forms.Control.ControlCollection ‘to’ and adds a method that can be really useful, is a method that seeks to recursively all kinds TextBox controls and erased its contents. < >
Convert a whole base 10 Binary in Java (Recursive)
How to filter the rows in a DataTable using a RowFilter (VB.Net)
S Factor – recursive function vs. iterative function