开发者

If I have an attribute declared over a method in an interface, do I need to put the attribute again in the method delcaration in the class?

Let's say I have a method such as

    [OperationContract(IsOneWay = true)]
    void UpdateIndex(IndexElement[] indexElements);

in an interface.

When I implement

    void UpdateIndex(IndexElement[] indexEl开发者_StackOverflowements);

in a class file, do I have to repaste the method attribute or will the compiler know from the definition in the interface?


For WCF interface attributes, you only need to put them on the interface methods, not the implementation. There are actually some different attributes that you can put on the implementation, but the "Contract" attributes only go on the interface.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜