Stuck... what the Syntax of doing...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Can somebody please tell me a simple thingy? How can I declare Indexers in VB .NET ???

MSDN comes up with C# topics indtead of VB thought I have filtered !! Its like ten thousan spoons when I need a knife!!

Thanks and have a nice and productive day!

mEEE
 
Public Class MyCollection
....
Public Default Property Item(index As Integer) As String
....
End Property
End Class

Are you looking for this?

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


eff_kay said:
Hi

Can somebody please tell me a simple thingy? How can I declare Indexers in VB .NET ???

MSDN comes up with C# topics indtead of VB thought I have filtered !! Its
like ten thousan spoons when I need a knife!!
 
* "=?Utf-8?B?ZWZmX2theQ==?= said:
Can somebody please tell me a simple thingy? How can I declare Indexers in VB .NET ???

Something like that:

\\\
Public Default Property Item(ByVal Index As Integer) As Integer
Get
Return array(Index)
End Get
Set(ByVal Value As Integer)
array(Index) = Value
End Set
End Property
///

As you can see, in VB.NET indexers are treated as properties. That's
why you can access them by their name: 'Foo(1)' is the same as
'Foo.Item(10)'. The latter cannot be done in C#.
 
Back
Top