System.Object Value { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Value property of the DefaultValueAttribute class represents the default value assigned to a property or field. This attribute is used to specify the initial value of a property, which can be useful for reflection purposes, especially when dealing with code generation scenarios.

Usage

To use the DefaultValueAttribute, apply it to a property or field in your class. This is particularly useful when you want to specify a default value for properties that are not simple types like numbers or strings, such as structs (e.g., vectors, colors).

Example usage:

[DefaultValue(10)]
public int MyProperty { get; set; }

[DefaultValue(typeof(Vector3), "0,0,0")]
public Vector3 Position { get; set; }

Example

[DefaultValue(10)]
public int MyProperty { get; set; }

[DefaultValue(typeof(Vector3), "0,0,0")]
public Vector3 Position { get; set; }