如何使用VB.Net实现接口? [英] How do I implement an interface with VB.Net?

查看:281
本文介绍了如何使用VB.Net实现接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VB.Net 2.0,我对实现

接口的概念完全陌生。任何人都可以解释实现接口对我来说,也许

给我一个实现一个接口的例子,它可以帮助我实现

在创建

中提到的IIneternetSecurityManager接口自定义URL安全管理器
http://msdn.microsoft.com/library/de...#SecurityZones

并在下载控制下提及
http://msdn.microsoft.com/library/de...nload_Control?


这将有助于我理解实现接口和我可以

然后为我公司的内部webbrowser实现更多。


感谢您的帮助!

I am using VB.Net 2.0 and I am completely new to the concept of implementing
interfaces. Can anyone explain "implementing interfaces" to me and perhaps
give me an example of implementing an interface that would help me implement
the IIneternetSecurityManager interface mentioned under "Creating a
Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I could
then implement a few more for my company''s internal webbrowser.

Thanks for your help!

推荐答案



" Jim" <再*** @ groups.please>在消息中写道

news:qf ******************* @ bignews5.bellsouth.net。 ..

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
我正在使用VB.Net 2.0,我对
实现接口的概念完全陌生。任何人都可以解释实现接口我可能会给我一个实现界面的例子,该界面将帮助我实现
创建自定义URL安全管理器中提到的IIneternetSecurityManager接口。
http://msdn.microsoft.com/library/de...#SecurityZones
并在下载控制下提及
http://msdn.microsoft.com/library/de...nload_Control?
这将有助于我理解实现界面,我可以
感谢您的帮助!
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I could
then implement a few more for my company''s internal webbrowser.

Thanks for your help!



为什么要交叉发布到一堆非适当的NG',请将你的

帖子限制在vb NG.


Willy。


Why cross-post to a bunch of non appropriate NG''s, please restrict your
postings to the vb NG only.

Willy.


感谢您提供最丰富,最有帮助的回复。

" Willy Denoyette [MVP]" <无线************* @ telenet.be>在消息中写道

新闻:eM ************* @ TK2MSFTNGP10.phx.gbl ...
Thank you for that most informative and helpful response.
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:eM*************@TK2MSFTNGP10.phx.gbl...

"吉姆" <再*** @ groups.please>在消息中写道
新闻:qf ******************* @ bignews5.bellsouth.net。 ..

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
我正在使用VB.Net 2.0,我对
实现接口的概念完全陌生。任何人都可以解释实现接口我可能会给我一个实现界面的例子,该界面将帮助我实现
创建自定义URL安全管理器中提到的IIneternetSecurityManager接口。
http://msdn.microsoft.com/library/de...#SecurityZones
并在下载控制下提及
http://msdn.microsoft.com/library/de...nload_Control?
这将有助于我理解实现界面,我可以
感谢您的帮助!
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I could
then implement a few more for my company''s internal webbrowser.

Thanks for your help!



为什么要交叉发布到一堆非适当的NG',请将您的
帖子限制在vb NG.

Willy。


Why cross-post to a bunch of non appropriate NG''s, please restrict your
postings to the vb NG only.

Willy.



Jim:


在.NET中我们没有多重继承但是通过使用接口,你可以通过和/或
到达同一个地方大。如果我有一个接口,那么

编译器知道每个方法和属性都必须存在于

类中 - 它可以指望它们在那里。所以在它最简单的形式中,实现一个接口的
只是在你的

类中为每个接口添加一个属性和方法。这样你就可以做到这一点....


IList myObject = new ObjectThatImplementsIList();

myObject.Item(0); // b / c IList有项目


现在,通过执行此操作,您可以将IList对象作为参数,然后

传入实现的任何内容IList b / c它有效地是一个IList

对象。


这有帮助吗?


" Jim" <再*** @ groups.please>在消息中写道

news:qf ******************* @ bignews5.bellsouth.net。 ..
Jim:

In .NET we don''t have multiple inheritance but by using interfaces, you can
get to the same place by and large. If I have an interface, then the
compiler knows that each fo the methods and properties must exist in the
class - it can count on them being there. So in it''s simplest form,
implementing an interface is simply adding a property and method to your
class for each one in the interface. That way you can do this....

IList myObject = new ObjectThatImplementsIList();
myObject.Item(0) ; //b/c IList has Item

Now, by doing this, you can take an IList object as a paramater and then
pass in anything that implements IList b/c it effectively "is" an IList
object.

Does this help?

"Jim" <re***@groups.please> wrote in message
news:qf*******************@bignews5.bellsouth.net. ..
我正在使用VB.Net 2.0,我对
实现接口的概念完全陌生。任何人都可以解释实现接口我可能会给我一个实现界面的例子,该界面将帮助我实现
创建自定义URL安全管理器中提到的IIneternetSecurityManager接口。
http://msdn.microsoft.com/library/de...#SecurityZones
并在下载控制下提及
http://msdn.microsoft.com/library/de...nload_Control?
这将有助于我理解实现界面,我可以
感谢您的帮助!
I am using VB.Net 2.0 and I am completely new to the concept of
implementing interfaces. Can anyone explain "implementing interfaces" to
me and perhaps give me an example of implementing an interface that would
help me implement the IIneternetSecurityManager interface mentioned under
"Creating a Customized URL Security Manager" on
http://msdn.microsoft.com/library/de...#SecurityZones
and mentioned under "Download Control" on
http://msdn.microsoft.com/library/de...nload_Control?

This would help me a great understand implementing interfaces and I could
then implement a few more for my company''s internal webbrowser.

Thanks for your help!



这篇关于如何使用VB.Net实现接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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