Need help converting VB Implements to C# Code

  • Thread starter Thread starter Jay Douglas
  • Start date Start date
J

Jay Douglas

I found an example that teaches me how to create my own collections ... but
the best one that I can find is in VB. I don't know how to convert the VB
"Implements" in to C# friendly code.. Could someone please help me convert
the snippet of code or provide a link to a good C# collections tutorial ...
Thanks.

-----------------------------------
Public Class Students
Implements IEnumerable

Private m_students As New ArrayList()

Public Sub New()
End Sub

Public ReadOnly Property Count() As Int32
Get
Return m_students.Count
End Get
End Property

Public Sub AddStudent( ByVal student As Student )
m_students.Add(student)
End Sub

' Impelementation of IEnumerable
Public Function GetEnumerator() As IEnumerator _
Implements System.Collections.IEnumerable.GetEnumerator

Return New StudentEnumerator( m_students )

End Function

End Class
 
public class Students : IEnumerable
{
ArrayList m_students = new ArrayList();
public Students()
{
}

public int Count
{
get
{
return m_students.Count;
}
}

public void AddStudent(Student student)
{
m_students.Add(student);
}

public IEnumerator GetEnumerator()
{
return m_students.GetEnumerator();
}
}
 
Back
Top