Properties
In vb.net & c# language Properties are differ. Code of Properties of vb.net & c# language.
____________________________________________________________________
VB.NET
Private _size As Integer
Public Property Size() As Integer
Get
Return _size
End Get
Set (ByVal Value As Integer)
If Value < 0 Then
_size = 0
Else
_size = Value
End If
End Set
End Property
foo.Size += 1
-------------------------------------------------------------------------------------------------
C#
private int _size;
public int Size {
get {
return _size;
}
set {
if (value < 0)
_size = 0;
else
_size = value;
}
}
foo.Size++;
-------------------------------------------------------------------------------------------------
Note: This code applicable for both desktop and web application.
No comments:
Post a Comment