<Runtime.CompilerServices.Extension()> _ Function Self(Of T)(ByVal x As T) As T Return x End FunctionExample:
With MyDataSet.Tables("SuperUsers") With .NewRow() .Item("FirstName") = "Mario" .Item("LastName") = "Lanza" .Item("SecurityLevel") = 10 .Rows.Add(.Self) End With End With
Provides Self method for all classes. This is useful inside a With block (when you don't want to declare a variable which references the object you are working with) as it allows you to assign the newly instantiated object. Use this when instantiating objects to which you need a moment's reference.
- Author: Mario T. Lanza
- Submitted on: 28-1-2009 23:55:39
- Language: VB
- Type: System.Object
- Views: 2506
Double click on the code to select all.