Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / August 2006

Tip: Looking for answers? Try searching our database.

Indexers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SalamElias - 06 Aug 2006 14:26 GMT
Can we code indexers in VB 2005 as in C#? if not what is the corresponding
feature.
Thanks
David Anton - 06 Aug 2006 16:13 GMT
Public Class ClassWithIndexer
    Private x As Integer()
    Public Default Property Item(ByVal index As Integer) As Integer
        Get
            Return x(index)
        End Get
        Set
            x(index) = Value
        End Set
    End Property
End Class

The above VB code is the equivalent for the following C# code:
public class ClassWithIndexer
{
    private int[] x;
    public int this[int index]
    {
        get
        {
            return x[index];
        }
        set
        {
            x[index] = value;
        }
    }
}
Signature

David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#

> Can we code indexers in VB 2005 as in C#? if not what is the corresponding
> feature.
> Thanks
SalamElias - 06 Aug 2006 17:26 GMT
Thanks, have a good day

> Public Class ClassWithIndexer
>     Private x As Integer()
[quoted text clipped - 28 lines]
> > feature.
> > Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.