Anhang B. Syntaxvergleich: C# 4.0 (C# 2010) versus Visual Basic 10.0 (VB 2010)

In diesem Anhang:

Die folgende Tabelle zeigt einen repräsentativen Ausschnitt der Syntaxelemente der beiden Programmiersprachen im Vergleich. Diese Tabelle ist nicht vollständig.

Befehlswörter

Zweck

Visual Basic 2010

C# 2010

Einsprungpunkt

Sub Main(ByVal args() As String)

static void Main(string[] args)

Namensraum

Namespace X
 ...
End Namespace
namespace X {
...
}

Klasse

Class
...
End Class
class {
...
}

Öffentliche Klasse

Public Class

public class

Klasse nur innerhalb der Assembly sichtbar

Friend Class

internal class

Partielle Klasse

Partial Class

partial class

Variablendeklaration/ Attributdefinition als Field

Dim x as Typ

Typ x

Attributdefinition als Property ...

Get Microsoft .NET 4.0 - Crashkurs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.