草庐IT

human-interface-guidelines

全部标签

c# - 为什么我们必须命名接口(interface)方法参数?

在C#中,我们必须命名接口(interface)方法的参数。我知道即使我们没有必要,这样做也会帮助读者理解意思,但在某些情况下并不是真的需要:interfaceIRenderable{voidRender(GameTime);}我想说上面的内容和下面的一样具有可读性和意义:interfaceIRenderable{voidRender(GameTimegameTime);}是否有一些技术原因要求接口(interface)上方法的参数名称?值得注意的是,接口(interface)方法的实现可以使用与接口(interface)方法中不同的名称。 最佳答案

c# - 为什么我们必须命名接口(interface)方法参数?

在C#中,我们必须命名接口(interface)方法的参数。我知道即使我们没有必要,这样做也会帮助读者理解意思,但在某些情况下并不是真的需要:interfaceIRenderable{voidRender(GameTime);}我想说上面的内容和下面的一样具有可读性和意义:interfaceIRenderable{voidRender(GameTimegameTime);}是否有一些技术原因要求接口(interface)上方法的参数名称?值得注意的是,接口(interface)方法的实现可以使用与接口(interface)方法中不同的名称。 最佳答案

c# - 记录 WCF 接口(interface)的最佳方式?

关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion因此,我正在使用WCF,并希望记录我的界面和服务,以提供给另一家公司用于内部应用程序。记录这些接口(interface)的最佳方式是什么?我更喜欢将文档与代码内联,然后进行一些美化以输出HTML,但我不确定是否有推荐的方法来做到这一点。

c# - 记录 WCF 接口(interface)的最佳方式?

关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion因此,我正在使用WCF,并希望记录我的界面和服务,以提供给另一家公司用于内部应用程序。记录这些接口(interface)的最佳方式是什么?我更喜欢将文档与代码内联,然后进行一些美化以输出HTML,但我不确定是否有推荐的方法来做到这一点。

c# - 通用接口(interface)方法的开放委托(delegate)

我正在尝试创建一个openinstancedelegate对于通用接口(interface)方法,但我一直收到NotSupportedException。这是不会运行的简化代码:interfaceIFoo{voidBar(Tj);}classFoo:IFoo{publicvoidBar(Tj){}}staticvoidMain(string[]args){varbar=typeof(IFoo).GetMethod("Bar").MakeGenericMethod(typeof(int));varx=Delegate.CreateDelegate(typeof(Action),null,

c# - 通用接口(interface)方法的开放委托(delegate)

我正在尝试创建一个openinstancedelegate对于通用接口(interface)方法,但我一直收到NotSupportedException。这是不会运行的简化代码:interfaceIFoo{voidBar(Tj);}classFoo:IFoo{publicvoidBar(Tj){}}staticvoidMain(string[]args){varbar=typeof(IFoo).GetMethod("Bar").MakeGenericMethod(typeof(int));varx=Delegate.CreateDelegate(typeof(Action),null,

c# - 当我在接口(interface)方法调用中忘记 `await` 时没有警告

考虑:usingSystem.Threading.Tasks;classProgram{staticvoidMain(string[]args){Cc=newC();c.FooAsync();//warningCS4014:Becausethiscallisnotawaited,executionofthecurrentmethodcontinuesbeforethecalliscompleted.Considerapplyingthe'await'operatortotheresultofthecall.((I)c).FooAsync();//Nowarning}}classC:I{

c# - 当我在接口(interface)方法调用中忘记 `await` 时没有警告

考虑:usingSystem.Threading.Tasks;classProgram{staticvoidMain(string[]args){Cc=newC();c.FooAsync();//warningCS4014:Becausethiscallisnotawaited,executionofthecurrentmethodcontinuesbeforethecalliscompleted.Considerapplyingthe'await'operatortotheresultofthecall.((I)c).FooAsync();//Nowarning}}classC:I{

c# - 从基接口(interface)继承的接口(interface)

场景:我正在使用ASP.NETMVC3和C#。我有很多服务都有一个Init()方法。所以,我想,继承是我最好的新friend。我尝试过从其他接口(interface)继承接口(interface)。但是,我遇到了问题。我做了什么:据我了解,一个接口(interface)可以继承自另一个接口(interface)。即,您可以这样做:publicinterfaceICaseService:IBaseService{CaseViewModelViewModel{get;}CaseCase{get;set;}}地点:publicinterfaceIBaseService{voidInit();

c# - 从基接口(interface)继承的接口(interface)

场景:我正在使用ASP.NETMVC3和C#。我有很多服务都有一个Init()方法。所以,我想,继承是我最好的新friend。我尝试过从其他接口(interface)继承接口(interface)。但是,我遇到了问题。我做了什么:据我了解,一个接口(interface)可以继承自另一个接口(interface)。即,您可以这样做:publicinterfaceICaseService:IBaseService{CaseViewModelViewModel{get;}CaseCase{get;set;}}地点:publicinterfaceIBaseService{voidInit();