Class ObjectTypeSymbol
Represents a structured MuLang object type.
public sealed class ObjectTypeSymbol : TypeSymbol
- Inheritance
-
ObjectTypeSymbol
- Inherited Members
Constructors
ObjectTypeSymbol(string, string, bool, IEnumerable<ObjectPropertySymbol>)
Initializes a new instance of the ObjectTypeSymbol class.
public ObjectTypeSymbol(string id, string name, bool isOpen, IEnumerable<ObjectPropertySymbol> properties)
Parameters
idstringThe provider identifier.
namestringThe language name.
isOpenboolA value indicating whether undeclared properties are permitted.
propertiesIEnumerable<ObjectPropertySymbol>The declared object properties.
Exceptions
- ArgumentException
Thrown when the identifier or name is invalid, or when a property name is duplicated.
- ArgumentNullException
Thrown when
propertiesisnull.
Properties
DisplayName
Gets the language-facing display name.
public override string DisplayName { get; }
Property Value
Id
Gets the provider identifier, or null for a compiler-defined type.
public string? Id { get; }
Property Value
IsOpen
Gets a value indicating whether undeclared properties are permitted.
public bool IsOpen { get; }
Property Value
Name
Gets the language name.
public string Name { get; }
Property Value
Properties
Gets the declared properties.
public IReadOnlyCollection<ObjectPropertySymbol> Properties { get; }
Property Value
Methods
CreateAnonymous(bool, IEnumerable<ObjectPropertySymbol>)
Creates an anonymous structured object type inferred by the compiler.
public static ObjectTypeSymbol CreateAnonymous(bool isOpen, IEnumerable<ObjectPropertySymbol> properties)
Parameters
isOpenboolA value indicating whether undeclared properties are permitted.
propertiesIEnumerable<ObjectPropertySymbol>The inferred object properties.
Returns
- ObjectTypeSymbol
The anonymous structured object type.
Exceptions
- ArgumentNullException
Thrown when
propertiesisnull.- ArgumentException
Thrown when a property name is duplicated.
TryGetProperty(string, out ObjectPropertySymbol?)
Gets a property by name.
public bool TryGetProperty(string name, out ObjectPropertySymbol? property)
Parameters
namestringThe language name.
propertyObjectPropertySymbolWhen this method returns, contains the property, if found.
Returns
- bool
trueif a property with the specified name was found; otherwise,false.