Table of Contents

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

Func<string, string>

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

Func<string, string>

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

name string

The 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

name string

The name to transform.

Returns

string

The name without a trailing Async suffix.