My question stems from the code samples from Wrox Press’s Professional ASP.NET Design Patterns. The code downloads are in C#, however, I’m working through the samples in VB.
I would appreciate if someone could explain what ‘this’ means in the following method signature, and what the equivalent method signature would be in VB.NET.
Here is the code sample (from p.51) in question:
public static void Apply(this IList<Product> products, IDiscountStrategy discountStrategy) { ... }
This is an extension method. The this indicates that you can call the static method with the following syntax:
as opposed to to
In VB you would decorate the method with the
ExtensionattributeSee http://msdn.microsoft.com/en-us/library/bb384936.aspx for more