語言

JsonRpcMethodAttribute 類別

定義

屬性會改變此方法在 JSON-RPC 上可被呼叫的名稱。 若套用於方法,該方法的 CLR 名稱將無法用於遠端調用。

[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class JsonRpcMethodAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type JsonRpcMethodAttribute = class
    inherit Attribute
Public Class JsonRpcMethodAttribute
Inherits Attribute
繼承
JsonRpcMethodAttribute
屬性

備註

當 rpc 訊息方法名稱可能與實際 CLR 方法名稱不同時,應使用此屬性。 當 rpc 訊息方法名稱包含 CLR 方法名稱的非法字元,例如「text/OnDocumentChanged」時,這很有用。

若方法過載,每個超載必須定義其所有相同值的超 JsonRpcMethodAttribute 載。 衝突會導致施工過程中 JsonRpc 產生錯誤。

如果方法被覆寫,基底類別可以定義一個 JsonRpcMethodAttribute ,衍生類別會繼承該屬性。 若導出類別與基底類別在某方法值衝突 JsonRpcMethodAttribute ,建構過程中 JsonRpc 會拋出錯誤。

建構函式

名稱 Description
JsonRpcMethodAttribute()

初始化 JsonRpcMethodAttribute 類別的新執行個體。

JsonRpcMethodAttribute(String)

初始化 JsonRpcMethodAttribute 類別的新執行個體。

屬性

名稱 Description
ClientRequiresNamedArguments

會取得或設定一個值,指示是否應使用 JSON-RPC 命名參數作為回傳給用戶端的回調。

Name

取得將以此方法呼叫的公開 RPC 名稱。

UseSingleObjectParameterDeserialization

取得或設定一個值,指示是否應將 JSON-RPC 命名參數全部反序列化成 RPC 方法的第一個參數。

適用於