Re: public DataValue this[int column] indexing with int ???
- From: Larry Lard <larrylard@xxxxxxxxxxxxxx>
- Date: Thu, 31 Aug 2006 10:41:43 +0100
John Liu wrote:
Some history, perhaps. I think the history of this goes back to VB6
(and may be other languages)
VBA more than VB.
> , there was this incredibly frustrating
idea called the default property. It got murdered in VB.NET (and there
was much rejoicing!)
No it didn't:
Public Class Foo
Private BarStuff As Integer() = New Integer(10) {}
Default Public Property Bar(ByVal i As Integer) As Integer
Get
Return BarStuff(i)
End Get
Set(ByVal value As Integer)
BarStuff(i) = value
End Set
End Property
End Class
And look, in VB.NET you can have default properties indexes by more than one parameter! Can't do that with a C# indexer:
Public Class Fooz
Private BarStuff As Integer(,) = New Integer(10, 20) {}
Default Public Property Bar(ByVal i As Integer, ByVal j As Integer) As Integer
Get
Return BarStuff(i, j)
End Get
Set(ByVal value As Integer)
BarStuff(i, j) = value
End Set
End Property
End Class
Usage:
Sub Main()
Dim f As New Foo, z As New Fooz
f(3) = 5
z(4, 5) = 6
End Sub
This concludes the cross-cultural lesson for today.
--
Larry Lard
larrylard@xxxxxxxxxxxxxx
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
.
- References:
- public DataValue this[int column] indexing with int ???
- From: webmaster
- Re: public DataValue this[int column] indexing with int ???
- From: Mythran
- Re: public DataValue this[int column] indexing with int ???
- From: John Liu
- public DataValue this[int column] indexing with int ???
- Prev by Date: Re: Using SmtpClient on a client computer not possible?
- Next by Date: Custom control design time property problem.
- Previous by thread: Re: public DataValue this[int column] indexing with int ???
- Next by thread: .NET DLL use in VB6
- Index(es):
Relevant Pages
|