Class CommonMethodNameTransforms
- Namespace
- Nerdbank.JsonRpc
- Assembly
- Nerdbank.JsonRpc.dll
Provides commonly used transforms for mapping CLR method names to JSON-RPC method names, for use with MethodNameTransform and MethodNameTransform.
public static class CommonMethodNameTransforms
- Inheritance
-
CommonMethodNameTransforms
- Inherited Members
Properties
Default
Gets the default transform: removes a trailing Async suffix (if any) and converts the result to camelCase.
public static Func<string, string> Default { get; }
Property Value
Remarks
For example, GetValueAsync becomes getValue and Ping becomes ping.
Identity
Gets a transform that returns the CLR method name unchanged.
public static Func<string, string> Identity { get; }
Property Value
Remarks
Use this to interoperate with a StreamJsonRpc peer that has not configured its own method name transform,
since StreamJsonRpc's default behavior is to send and expect CLR-style names (e.g. GetValueAsync).
Methods
CamelCase(string)
Converts the first character of a name to lowercase, leaving the rest unchanged.
public static string CamelCase(string name)
Parameters
namestringThe name to transform.
Returns
- string
The camelCased name.
RemoveAsyncSuffix(string)
Removes a trailing ordinal Async suffix from a name, if present.
public static string RemoveAsyncSuffix(string name)
Parameters
namestringThe name to transform.
Returns
- string
The name without a trailing
Asyncsuffix.