A.7. Enumerations

Table of contents:

A 7 Enumerations

C# uses the enum statement along with opening and closing braces, { }, to indicate the beginning and end of an enumeration definition. For example:

public enum CommandType {
 // Enumeration members 

In VB, an enumeration is defined by the Enum ... End Enum construct. For example, the VB version of the CommandType enum declaration is:

Public Enum CommandType
  enumeration members
End Enum

In both C# and VB, the member listing consists of the name of the enumerated member and its value. These are identical in C# and VB, except that C# adds a comma to separate one member of the enumeration from another, whereas VB requires that they be on separate lines. For example, the full declaration of the CommandType enumeration in C# is:

public enum CommandType {
 Text = 1, 
 StoredProcedure = 4, 
 TableDirect = 512

The VB equivalent is:

Public Enum CommandType
 Text = 1 
 StoredProcedure = 4
 TableDirect = 512
End Enum

Connecting to Data

Retrieving and Managing Data

Searching and Analyzing Data

Adding and Modifying Data

Copying and Transferring Data

Maintaining Database Integrity

Binding Data to .NET User Interfaces

Working with XML

Optimizing .NET Data Access

Enumerating and Maintaining Database Objects

Appendix A. Converting from C# to VB Syntax

ADO. NET Cookbook
ADO.NET 3.5 Cookbook (Cookbooks (OReilly))
ISBN: 0596101406
EAN: 2147483647
Year: 2002
Pages: 222
Authors: Bill Hamilton

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net