TAILIEUCHUNG - Class, Structure, and Interface Members

[ Team LiB ] Class, Structure, and Interface Members Classes, structures, and interfaces can contain one or more fields, methods, properties, and events. This section discusses converting the C# syntax for each of these constructs to Visual Basic | Team LiB Class Structure and Interface Members Classes structures and interfaces can contain one or more fields methods properties and events. This section discusses converting the C syntax for each of these constructs to Visual Basic. Note that .NET supports both static or shared members which apply to the type as a whole and typically don t require that an object of that type be instantiated and instance members which apply only to an instance of that type . Shared or static members are indicated by using the static keyword in C . For example public static string ToString long value The corresponding VB keyword is Shared so the ToString method when converted to VB has the following syntax Public Shared Function ToString value As Long As String Fields A field is simply a constant or a variable that is exposed as a publicly accessible member of a type. In C for example the Value field of the class has the syntax public static readonly DBNull Value Note that C indicates the data type of a field before the name of the field. For C data types and their VB equivalents see Table A-3. Also note that fields are frequently readonly. Constant fields in fact are always read-only. As a result the use of the C readonly keyword and the VB ReadOnly keyword with fields is quite common. The syntax for the Value field in Visual Basic then becomes Public Shared ReadOnly Value As DBNull Methods In C all methods have a return value which appears before the name of the function in contrast VB differentiates between function and subprocedures. C functions without an explicit return value return void. For example one of the overloads of the DataSet class s AcceptChanges method has the following syntax in C public void AcceptChanges C methods that return void are expressed as subprocedures in VB. Here s the corresponding syntax of the AcceptChanges method Public Sub AcceptChanges All C methods other than those returning void are functions in VB. The function

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.