Delphi支持功能 [英] Delphi supports function

查看:53
本文介绍了Delphi支持功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是C#的新手,想知道是否有人知道delphi的"Supports"功能的等效c#方法是什么.它比较记录集的功能,但我找不到在c#中做相同功能的方法.

感谢advane,
Jo

Hi,

I''m rather new to c# and would like to know if anybody knows what the equivalent c# method is for the delphi ''Supports'' function. It compares functionality of recordsets and I cannot find a method that does the same in c#.

Thanks in adnvane,
Jo

推荐答案

使用IS进行检查.使用c#,接口的支持是该语言的本机,因此可以像其他任何类类型一样进行处理.

Check it using IS. With c# the support for interfaces is more native to the language so can be handled like any other class type.

if (myObject is IMyInterface)
{
   IMyInterface iMyInterface= (IMyInterface) myObject;
}
else
{
   console.WriteLine ("Interface unsupported");
}



祝你好运!



Good luck!


这篇关于Delphi支持功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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