A.1. General Considerations

The most evident difference between C# and Visual Basic (VB) syntax is that C# uses the semicolon ( ; ) as a statement terminator, whereas VB uses a line break. As a result, a statement in C# can occupy multiple lines as long as it is terminated with a semicolon. A VB statement must occupy only a single line. Multiline statements in VB must appear with the VB line continuation character (a space followed by an underscore ) on all but the last line.

A second, and not quite so evident, difference is that C# is case sensitive, whereas VB isn . (Uniform case use for VB code is enforced by the Visual Studio environment, but it is by no means required.)

Finally, all types and their members have access modifiers that determine the type or members accessibility. The keywords for these access modifiers are nearly identical in VB and C#, as Table A-1 shows.

Table A-1. Access modifiers in C# and VB

C# keyword

VB keyword

public

Public

private

Private

protected

Protected

internal

Friend

protected internal

Protected Friend

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