InterfaceDeclaration Class

Represents an interface declaration.

Example

var iface = new InterfaceDeclaration("IRepository");
var typeParameter = new TypeParameter("T");
iface.Parameters.Add(typeParameter);
iface.Members.Add(new MethodDeclaration("Get") { ReturnType = typeParameter });
var code = iface.ToCsharpString();

Assert.StartsWith("interface IRepository<T>", code);
Assert.Contains("Get();", code);
Inheritance
TypeDeclaration InterfaceDeclaration
Implements

Constructors

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

InterfaceDeclaration overloads

InterfaceDeclaration()

InterfaceDeclaration.cs
public InterfaceDeclaration()

No documentation is available.

InterfaceDeclaration(string?)

InterfaceDeclaration.cs

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

public InterfaceDeclaration(string? name)
Parameters
name string?
The interface name.

Properties

NameDescription
BaseType
Implements
Members
Parameters
Types
public TypeReference? BaseType { get; set; }

Property value

TypeReference?

No documentation is available.

public IList<TypeReference> Implements { get; }

Property value

IList<TypeReference>

No documentation is available.

public CodeObjectCollection<MemberDeclaration> Members { get; }

No documentation is available.

public CodeObjectCollection<TypeParameter> Parameters { get; }

No documentation is available.

public CodeObjectCollection<TypeDeclaration> Types { get; }

No documentation is available.