Table of Contents

Class Role<T>

Namespace
ICSharpCode.Decompiler.CSharp.Syntax
Assembly
ICSharpCode.Decompiler.dll

Represents the role a node plays within its parent. All nodes with this role have type T.

public class Role<T> : Role where T : class?

Type Parameters

T
Inheritance
Role<T>
Derived
Inherited Members

Constructors

Role(string)

[Obsolete("Use the other overload explicitly specifying the nullObject.")]
public Role(string name)

Parameters

name string

Role(string, T)

public Role(string name, T nullObject)

Parameters

name string
nullObject T

Properties

NullObject

Gets the null object used when there's no node with this role. Not every role has a null object; this property returns null for roles without a null object.

public T NullObject { get; }

Property Value

T

Remarks

Roles used for non-collections should always have a null object, so that no AST property returns null. However, if a role used for collections only, it may leave out the null object.

Methods

IsValid(object)

Gets whether the specified node is valid in this role.

public override bool IsValid(object node)

Parameters

node object

Returns

bool

ToString()

public override string ToString()

Returns

string