DelegateDeclaration Class

Represents a delegate declaration.

public class DelegateDeclaration : TypeDeclaration, IParametrableType

Example

var del = new DelegateDeclaration("MyDelegate");
del.ReturnType = typeof(void);
del.Arguments.Add(new MethodArgumentDeclaration(typeof(string), "message"));

Assert.Equal("""
    delegate void MyDelegate(string message);

    """, del.ToCsharpString());
Inheritance
TypeDeclaration DelegateDeclaration
Implements

Constructors

NameDescription
DelegateDeclaration()
DelegateDeclaration(string?)Initializes a new instance of the DelegateDeclaration class with the specified name.

DelegateDeclaration overloads

DelegateDeclaration()

DelegateDeclaration.cs
public DelegateDeclaration()

No documentation is available.

DelegateDeclaration(string?)

DelegateDeclaration.cs

Initializes a new instance of the DelegateDeclaration class with the specified name.

public DelegateDeclaration(string? name)
Parameters
name string?
The delegate name.

Properties

NameDescription
Arguments
Parameters
ReturnType
public MethodArgumentCollection Arguments { get; }

No documentation is available.

public CodeObjectCollection<TypeParameter> Parameters { get; }

No documentation is available.

public TypeReference? ReturnType { get; set; }

Property value

TypeReference?

No documentation is available.