Vb. NET programming language has a wide variety of data types, it is a difficult step for beginners to master all these types of applications. Today, let's get to know the application of the higher-order technology of the vb.net generic type, so that we can understand the language in depth.
When you define a vb.net generic type, it is parameterized even with one or more data types. This allows you to customize the data type with code to meet its requirements. The code can declare several different programming elements through a generic element, each of which can use a different set of data types. However, regardless of which data types are used by the declared element, they perform the same logic.
Base class definition
Namespace result public MustInherit Class result public Sub New () End Sub Property msg as String Property success as Boolean End classend Namespace
To define a function implementation:
Shared Function Resultt (Of T as Models.result.result) (msg as String) as T Dim rsp As T = Nothing Dim parser as Mod Els.result.result = Nothing rsp.msg = msg rsp.success = False return RSP ' return New API. Resultobj (of T) with {. msg = msg,. Success = False} End Function
Invocation Example:
Return RESULTT (of Models.result.httputil) (msg)
Application experience of vb.net generic type