私は完全な C# 派だが、最近は Visual Basic が美しく見えてしょうがない。
Visual Basic は大文字小文字は同一扱いだが、「キーワード」の最初の文字は大文字にするのが多数派だと思う。Visual Studio の「コードの再フォーマット」が有効になっていれば、自動的にそうなるだろう。
Visual Basic 8.0
Module Module1
Sub Main()
Dim i As Integer
i = 1
Console.WriteLine(i)
End Sub
End Module
Public Class TestClass
Private _id As Integer
Private _name As String
Public Property ID() As Integer
Get
Return _id
End Get
Set(ByVal value As Integer)
_id = value
End Set
End Property
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
End Class
Visual Basic は単語の「全て」が大文字になっていて統一感がある。
C# 2.0?
Class Program
{
Static Void Main( String[] args )
{
Int32 i = 1;
Console.WriteLine( i );
}
}
Public Class TestClass
{
Private Int32 _id;
Private String _name;
Public Int32 ID
{
Get { Return _id; }
Set { _id = value; }
}
Public String Name
{
Get { Return _neme; }
Set { _name = value; }
}
}
この方が美しくないだろうか?