This is ok in C#
:
private int total;
public int Total {
get {
return total;
}
}
So the backing field total
is spelled the same as the Property
Total
with the only thing telling them apart being the case of the T
.
With VB.NET
VS complains if I try to do the following. In fact it won't even let me write Return total
with a lower case t
and auto-corrects to an upper case T
But if I spell the backing field differently then it seems to be ok:
Private fTotal As Integer
Public ReadOnly Property Total() As Integer
Get
Return fTotal
End Get
End Property
I realize they are different languages but is there a logical reason behind this difference? (EDIT originally said "apparent inconsistency" rather than "difference")
Also - I assume even though Visual Studio auto-corrects the case of my VB.NET but in reality this language is not case-sensitive?