English 中文(简体)
建立有接口的班级。 之后,它又在编码背后进行。
原标题:Create classes with interfaces. Then iterate though it in codebehind

我对包括接口在内的班级存在问题。 我有大约12个班级,有相同的接口。 现在,我需要列出所有课程。 在这种特征中,可以有1,000个新类别,以创造。 但是,由于他们对设备负责,有些类型的设备已经陈旧。

Ok. 没有问题通过使用分类列出所有类别

dim ClassList as new List(Of MyInterface)
ClassList.Add(New MyFirstItem())
ClassList.Add(New MySecondItem())
ClassList.Add(New MyThirdItem())
ClassList.Add(New ...)

之后

For each item as MyInterface in ClassList
    Print info
next

that what I am doing NOW.

www.un.org/Depts/DGACM/index_spanish.htm 我想问,我是否可以讲明视觉演播室或我的应用,我有一个解决方案夹,所有书写的课堂,并将这些项目自动列入清单。 或者,它像花.一样。 我想避免上述内容。 而且,我想避免为每一类的某种法典系建立一个完整的新项目。

ClassList.Add(New ...)  would like to avoid this to do manually

只是为了立案并立即进行处理,以在屏幕上书写分类信息。

我希望我能解释我的问题。

关于

问题回答

假设你的所有班级都列在自己的档案中,在名录中标明他们的班级名称,你可以做些什么,把你的行文引到像这样的文字档案中:

String[] Files= Directory.GetFiles("PATH", "*.cs");                
foreach (String file in Files)
{
    WriteLine("ClassList.Add(new " + file.Replace(".cs", "") + ");");
}




相关问题
STL iterator as return value

I have class A, that contains std::vector and I would like to give an access to the vector from outside class A. The first thing that came to my mind is to make a get function that returns iterator ...

Create a new Tuple with one element modified

(I am working interactively with a WordprocessingDocument object in IronPython using the OpenXML SDK, but this is really a general Python question that should be applicable across all implementations) ...

Is it possible to use a RA-iterator out of range?

Consider the following code: typedef std::vector<int> cont_t; // Any container with RA-iterators typedef cont_t::const_iterator citer_t; // Random access iterator cont_t v(100); const int ...

Are Multiple Iterators possible in c=C#?

Are multiple iterators (for a single class or object) possible in C# .NET? If they are, give me some simple examples. Sorry if the question is not understandable and please make me clear.

热门标签