Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ internal CSharpType(
}

public string Namespace { get; set; }
public string Name { get; private init; }

/// <summary>
/// Gets or sets the name of the type.
/// </summary>
public string Name { get; set; }
internal string FullyQualifiedName { get; private init; }
public CSharpType? DeclaringType { get; private init; }
public bool IsValueType { get; private init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,31 @@ private IReadOnlyList<FieldProvider> BuildAllCustomFields()
protected string? _deprecated;

/// <summary>
/// Gets the relative file path where the generated file will be stored.
/// Gets and sets the relative file path where the generated file will be stored.
/// This path is relative to the project's root directory.
/// </summary>
internal string RelativeFilePath => _relativeFilePath ??= BuildRelativeFilePath();
public string RelativeFilePath
{
get => _relativeFilePath ??= BuildRelativeFilePath();
set
{
_relativeFilePath = value;
}
}

private string? _relativeFilePath;

public string Name => _name ??= CustomCodeView?.Name ?? BuildName();
/// <summary>
/// Gets and sets the name of the type.
/// </summary>
public string Name
{
get => _name ??= CustomCodeView?.Name ?? BuildName();
set
{
_name = value;
}
}

private string? _name;

Expand Down Expand Up @@ -120,7 +137,17 @@ public string? Deprecated

private TypeSignatureModifiers? _declarationModifiers;

public TypeSignatureModifiers DeclarationModifiers => _declarationModifiers ??= BuildDeclarationModifiersInternal();
/// <summary>
/// Gets and sets the declaration modifiers for the type.
/// </summary>
public TypeSignatureModifiers DeclarationModifiers
{
get => _declarationModifiers ??= BuildDeclarationModifiersInternal();
set
{
_declarationModifiers = value;
}
}

protected virtual TypeSignatureModifiers BuildDeclarationModifiers() => TypeSignatureModifiers.None;

Expand Down Expand Up @@ -325,9 +352,7 @@ public void Update(
IEnumerable<FieldProvider>? fields = null,
IEnumerable<TypeProvider>? serializations = null,
IEnumerable<TypeProvider>? nestedTypes = null,
XmlDocProvider? xmlDocs = null,
TypeSignatureModifiers? modifiers = null,
string? relativeFilePath = null)
XmlDocProvider? xmlDocs = null)
{
if (methods != null)
{
Expand Down Expand Up @@ -357,14 +382,6 @@ public void Update(
{
XmlDocs = xmlDocs;
}
if (modifiers != null)
{
_declarationModifiers = modifiers;
}
if (relativeFilePath != null)
{
_relativeFilePath = relativeFilePath;
}
}
public IReadOnlyList<EnumTypeMember> EnumValues => _enumValues ??= BuildEnumValues();

Expand Down
Loading