如何从实现相同接口的类执行所有方法? [英] How to execute all methods from classes that implements same interface?

查看:227
本文介绍了如何从实现相同接口的类执行所有方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,



i希望找到所有实现相同界面的类,

并执行该类中的方法。



说明:



1)在vs 2010中添加解决方案

2)添加课程库项目,在其中添加一个接口说IClass

3)在解决方案中添加2个不同的项目(比如project1,project2),每个项目包含一个实现IClass接口的类。 br />
4)重要提示这两个项目的参考资料将不会添加到我们的mvc项目中,该项目将在下一步添加。



5)添加MVC项目并编写代码,找到解决方案中的所有类,实现IClass接口并执行其中的方法



注意:

(每个项目只提供接口项目参考)



提前感谢

hello friends ,

i want to finds all classes that implements same interface,
and executes methods within that class.

Explanation:

1) add solution in vs 2010
2) add class library project ,with in that add one interface say "IClass"
3) add 2 different project(say project1,project2) in the solution, each one contain one class that implements "IClass" interface.
4) Important note no reference of these 2 project will be added to our mvc project which will be added in next step.

5) add MVC Project and write code that find all the classes from solution which implements "IClass" interface and execute methods within that

Note:
(only Reference of Interface project is given to each project)

thanks in advance

推荐答案

我们做不做你的作业:它是为了一个原因。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!


这篇关于如何从实现相同接口的类执行所有方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆