I'm having a bit of an issue inheriting from a class. I'm taking code from an old VB.NET app and writing it in C#. I have a public class which only consists of 2 fields, a constructor and 2 properties.
I need to inherit a generic list object which isn't a problem, but my environment doesn't see the class from which it must inherit.
Class: MyClass
When I try to inherit MyClass from my Collection object, I can't...
What I want to do is:
In VB.NET, the code looks like this:
How can I achieve the same result in C#?
I need to inherit a generic list object which isn't a problem, but my environment doesn't see the class from which it must inherit.
Class: MyClass
Code:
public class MyClass
{
#region /// FIELDS ///
string columnName;
string format;
#endregion
#region /// CONSTRUCTORS ///
public MyClass()
{
columnName = "";
format = "";
}
public MyClass(string fieldName, string formatString)
{
columnName = fieldName;
format = formatString;
}
#endregion
#region /// PROPERTIES ///
public string ColumnName
{ get; set; }
public string Format
{ get; set; }
#endregion
}
When I try to inherit MyClass from my Collection object, I can't...
What I want to do is:
Code:
public class Collections : List<MyClass>
In VB.NET, the code looks like this:
Code:
Public Class Collections
Inherits List(Of MyClass)
Public Sub New()
MyBase.New()
End Sub
End Class
How can I achieve the same result in C#?
Comment