is it possible in C# to have something like this?
Public Property foo(ByVal a As Integer, ByVal b As Integer) As Integer
Get
End Get
Set(ByVal Value As Integer)
End Set
End Property
I can't figure out how to pass arguments to a property
Printable View
is it possible in C# to have something like this?
Public Property foo(ByVal a As Integer, ByVal b As Integer) As Integer
Get
End Get
Set(ByVal Value As Integer)
End Set
End Property
I can't figure out how to pass arguments to a property
C# properties are parameterless . You can't do this .
what sadness!!!
I guess VB introduces bad programming habits:p
hmm not at all.
Properties in .NET are just methods(functions) that have a get_ / set_ as prefix.
I agree that sucks. Also you can't bind to a method but you can to a property. I think an indexer is the closest thing maybe:
VB Code:
public class fooTest { private int _foo; public int this[int a, int b] { get { return _foo; } set { _foo=value; } } } ////syntax fooTest f=new fooTest(); MessageBox.Show(f[1,1].ToString());