.NET Array Dictionary List String Sub ArrayList Cast Class Console Dates DataTable DateTime Enum File For Format If IndexOf Lambda LINQ Nothing Parse Process Property Regex Replace Select Sort Split StringBuilder SubstringFunction. A Function returns a value. It uses a special syntax form in the VB.NET language. The Function optionally accepts one or more parameters—these are called formal parameters. A Function is part of a Module, Class or Structure.Module
Tip: A Function is called from other Functions, Subs or Properties. It can be reused throughout a program.
Formal parameter: Area receives one formal parameter of type Double. Specifying the type of the parameter is optional but advised.Returns: The Function returns a value of type Double. After the formal parameter list, the keywords "As Double" indicate the return type.
Based on: .NET 4.5 VB.NET program that demonstrates Function Module Module1 ''' <summary> ''' Get area of a circle with specified radius. ''' </summary> Function Area(ByVal radius As Double) As Double Return Math.PI * Math.Pow(radius, 2) End Function Sub Main() Dim a As Double = Area(4.0) Console.WriteLine(a) End Sub End Module Output 50.2654824574367Functions vs. Properties. What is the difference between a Function and a Property? A Property is a type of Function. The Get part of a Property can be implemented as a Function. A Property is a special kind of Function—it indicates a different sort of behavior.
Tip: At the level of the implementation, Properties are similar to Functions and Subs.Property
And: If you want to, you can change all Properties on your types to Functions and Subs. You won't get in trouble for doing this.
But: On existing types, such as those in the .NET Framework, you must use the Property syntax if the member is a Property.