JsPropertyDescriptor<TValue> Struct

A property descriptor (https://tc39.es/ecma262/#sec-property-descriptor-specification-type).

public readonly struct JsPropertyDescriptor<TValue> where TValue : class

Type parameters

TValue

Properties

NameDescription
ConfigurableGets the [[Configurable]] attribute.
EnumerableGets the [[Enumerable]] attribute.
FlagsGets the fields and the boolean attributes of the descriptor.
GetterGets the [[Get]] field, or null when it is absent.
IsAccessorDescriptorGets whether the descriptor is an accessor descriptor (https://tc39.es/ecma262/#sec-isaccessordescriptor).
IsDataDescriptorGets whether the descriptor is a data descriptor (https://tc39.es/ecma262/#sec-isdatadescriptor).
SetterGets the [[Set]] field, or null when it is absent.
ValueGets the [[Value]] field, or null when it is absent.
WritableGets the [[Writable]] attribute.

Configurable

IJsAdapter.cs

Gets the [[Configurable]] attribute.

public bool Configurable { get; }

Property value

bool

Enumerable

IJsAdapter.cs

Gets the [[Enumerable]] attribute.

public bool Enumerable { get; }

Property value

bool

Gets the fields and the boolean attributes of the descriptor.

public JsPropertyFlags Flags { get; }

Property value

JsPropertyFlags

Gets the [[Get]] field, or null when it is absent.

public TValue? Getter { get; }

Property value

TValue?

IsAccessorDescriptor

IJsAdapter.cs

Gets whether the descriptor is an accessor descriptor (https://tc39.es/ecma262/#sec-isaccessordescriptor).

public bool IsAccessorDescriptor { get; }

Property value

bool

IsDataDescriptor

IJsAdapter.cs

Gets whether the descriptor is a data descriptor (https://tc39.es/ecma262/#sec-isdatadescriptor).

public bool IsDataDescriptor { get; }

Property value

bool

Gets the [[Set]] field, or null when it is absent.

public TValue? Setter { get; }

Property value

TValue?

Gets the [[Value]] field, or null when it is absent.

public TValue? Value { get; }

Property value

TValue?

Gets the [[Writable]] attribute.

public bool Writable { get; }

Property value

bool

Methods

NameDescription
Accessor(TValue, TValue, bool, bool)Creates an accessor property descriptor. getter and setter are functions or undefined.
Create(TValue?, TValue?, TValue?, JsPropertyFlags)Creates a partial descriptor (e.g. the argument of Object.defineProperty).
Data(TValue, bool, bool, bool)Creates a data property descriptor.

Accessor(TValue, TValue, bool, bool)

IJsAdapter.cs

Creates an accessor property descriptor. getter and setter are functions or undefined.

public static JsPropertyDescriptor<TValue> Accessor(TValue getter, TValue setter, bool enumerable, bool configurable)

Parameters

getter TValue
setter TValue
enumerable bool
configurable bool

Returns

JsPropertyDescriptor<TValue>

Create(TValue?, TValue?, TValue?, JsPropertyFlags)

IJsAdapter.cs

Creates a partial descriptor (e.g. the argument of Object.defineProperty).

public static JsPropertyDescriptor<TValue> Create(TValue? value, TValue? getter, TValue? setter, JsPropertyFlags flags)

Parameters

value TValue?
getter TValue?
setter TValue?
flags JsPropertyFlags

Returns

JsPropertyDescriptor<TValue>

Data(TValue, bool, bool, bool)

IJsAdapter.cs

Creates a data property descriptor.

public static JsPropertyDescriptor<TValue> Data(TValue value, bool writable, bool enumerable, bool configurable)

Parameters

value TValue
writable bool
enumerable bool
configurable bool

Returns

JsPropertyDescriptor<TValue>