132 lines
11 KiB
Markdown
132 lines
11 KiB
Markdown
# <a id="CapyKit_Attributes_ValueFormatAttribute"></a> Class ValueFormatAttribute
|
|
|
|
Namespace: [CapyKit.Attributes](CapyKit.Attributes.md)
|
|
Assembly: CapyKit.dll
|
|
|
|
Custom attribute for formatting values in a specific way.
|
|
|
|
```csharp
|
|
[AttributeUsage(AttributeTargets.Property)]
|
|
public class ValueFormatAttribute : Attribute
|
|
```
|
|
|
|
#### Inheritance
|
|
|
|
[object](https://learn.microsoft.com/dotnet/api/system.object) ←
|
|
[Attribute](https://learn.microsoft.com/dotnet/api/system.attribute) ←
|
|
[ValueFormatAttribute](CapyKit.Attributes.ValueFormatAttribute.md)
|
|
|
|
#### Inherited Members
|
|
|
|
[Attribute.Equals\(object?\)](https://learn.microsoft.com/dotnet/api/system.attribute.equals),
|
|
[Attribute.GetCustomAttribute\(Assembly, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattribute\#system\-attribute\-getcustomattribute\(system\-reflection\-assembly\-system\-type\)),
|
|
[Attribute.GetCustomAttribute\(Assembly, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattribute\#system\-attribute\-getcustomattribute\(system\-reflection\-assembly\-system\-type\-system\-boolean\)),
|
|
[Attribute.GetCustomAttribute\(MemberInfo, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattribute\#system\-attribute\-getcustomattribute\(system\-reflection\-memberinfo\-system\-type\)),
|
|
[Attribute.GetCustomAttribute\(MemberInfo, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattribute\#system\-attribute\-getcustomattribute\(system\-reflection\-memberinfo\-system\-type\-system\-boolean\)),
|
|
[Attribute.GetCustomAttribute\(Module, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattribute\#system\-attribute\-getcustomattribute\(system\-reflection\-module\-system\-type\)),
|
|
[Attribute.GetCustomAttribute\(Module, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattribute\#system\-attribute\-getcustomattribute\(system\-reflection\-module\-system\-type\-system\-boolean\)),
|
|
[Attribute.GetCustomAttribute\(ParameterInfo, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattribute\#system\-attribute\-getcustomattribute\(system\-reflection\-parameterinfo\-system\-type\)),
|
|
[Attribute.GetCustomAttribute\(ParameterInfo, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattribute\#system\-attribute\-getcustomattribute\(system\-reflection\-parameterinfo\-system\-type\-system\-boolean\)),
|
|
[Attribute.GetCustomAttributes\(Assembly\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-assembly\)),
|
|
[Attribute.GetCustomAttributes\(Assembly, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-assembly\-system\-boolean\)),
|
|
[Attribute.GetCustomAttributes\(Assembly, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-assembly\-system\-type\)),
|
|
[Attribute.GetCustomAttributes\(Assembly, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-assembly\-system\-type\-system\-boolean\)),
|
|
[Attribute.GetCustomAttributes\(MemberInfo\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-memberinfo\)),
|
|
[Attribute.GetCustomAttributes\(MemberInfo, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-memberinfo\-system\-boolean\)),
|
|
[Attribute.GetCustomAttributes\(MemberInfo, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-memberinfo\-system\-type\)),
|
|
[Attribute.GetCustomAttributes\(MemberInfo, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-memberinfo\-system\-type\-system\-boolean\)),
|
|
[Attribute.GetCustomAttributes\(Module\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-module\)),
|
|
[Attribute.GetCustomAttributes\(Module, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-module\-system\-boolean\)),
|
|
[Attribute.GetCustomAttributes\(Module, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-module\-system\-type\)),
|
|
[Attribute.GetCustomAttributes\(Module, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-module\-system\-type\-system\-boolean\)),
|
|
[Attribute.GetCustomAttributes\(ParameterInfo\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-parameterinfo\)),
|
|
[Attribute.GetCustomAttributes\(ParameterInfo, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-parameterinfo\-system\-boolean\)),
|
|
[Attribute.GetCustomAttributes\(ParameterInfo, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-parameterinfo\-system\-type\)),
|
|
[Attribute.GetCustomAttributes\(ParameterInfo, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.getcustomattributes\#system\-attribute\-getcustomattributes\(system\-reflection\-parameterinfo\-system\-type\-system\-boolean\)),
|
|
[Attribute.GetHashCode\(\)](https://learn.microsoft.com/dotnet/api/system.attribute.gethashcode),
|
|
[Attribute.IsDefaultAttribute\(\)](https://learn.microsoft.com/dotnet/api/system.attribute.isdefaultattribute),
|
|
[Attribute.IsDefined\(Assembly, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.isdefined\#system\-attribute\-isdefined\(system\-reflection\-assembly\-system\-type\)),
|
|
[Attribute.IsDefined\(Assembly, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.isdefined\#system\-attribute\-isdefined\(system\-reflection\-assembly\-system\-type\-system\-boolean\)),
|
|
[Attribute.IsDefined\(MemberInfo, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.isdefined\#system\-attribute\-isdefined\(system\-reflection\-memberinfo\-system\-type\)),
|
|
[Attribute.IsDefined\(MemberInfo, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.isdefined\#system\-attribute\-isdefined\(system\-reflection\-memberinfo\-system\-type\-system\-boolean\)),
|
|
[Attribute.IsDefined\(Module, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.isdefined\#system\-attribute\-isdefined\(system\-reflection\-module\-system\-type\)),
|
|
[Attribute.IsDefined\(Module, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.isdefined\#system\-attribute\-isdefined\(system\-reflection\-module\-system\-type\-system\-boolean\)),
|
|
[Attribute.IsDefined\(ParameterInfo, Type\)](https://learn.microsoft.com/dotnet/api/system.attribute.isdefined\#system\-attribute\-isdefined\(system\-reflection\-parameterinfo\-system\-type\)),
|
|
[Attribute.IsDefined\(ParameterInfo, Type, bool\)](https://learn.microsoft.com/dotnet/api/system.attribute.isdefined\#system\-attribute\-isdefined\(system\-reflection\-parameterinfo\-system\-type\-system\-boolean\)),
|
|
[Attribute.Match\(object?\)](https://learn.microsoft.com/dotnet/api/system.attribute.match),
|
|
[Attribute.TypeId](https://learn.microsoft.com/dotnet/api/system.attribute.typeid),
|
|
[object.Equals\(object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\)),
|
|
[object.Equals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\-system\-object\)),
|
|
[object.GetHashCode\(\)](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
|
|
[object.GetType\(\)](https://learn.microsoft.com/dotnet/api/system.object.gettype),
|
|
[object.MemberwiseClone\(\)](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone),
|
|
[object.ReferenceEquals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
|
|
[object.ToString\(\)](https://learn.microsoft.com/dotnet/api/system.object.tostring)
|
|
|
|
#### Extension Methods
|
|
|
|
[ObjectExtensions.UpdateProperties<ValueFormatAttribute\>\(ValueFormatAttribute, ValueFormatAttribute\)](CapyKit.Extensions.ObjectExtensions.md\#CapyKit\_Extensions\_ObjectExtensions\_UpdateProperties\_\_1\_\_\_0\_\_\_0\_),
|
|
[ObjectExtensions.UpdateProperties\(object, object\)](CapyKit.Extensions.ObjectExtensions.md\#CapyKit\_Extensions\_ObjectExtensions\_UpdateProperties\_System\_Object\_System\_Object\_)
|
|
|
|
## Constructors
|
|
|
|
### <a id="CapyKit_Attributes_ValueFormatAttribute__ctor"></a> ValueFormatAttribute\(\)
|
|
|
|
Default constructor. Initializes a new instance of the <xref href="CapyKit.Attributes.ValueFormatAttribute" data-throw-if-not-resolved="false"></xref>
|
|
class with an empty format string.
|
|
|
|
```csharp
|
|
public ValueFormatAttribute()
|
|
```
|
|
|
|
### <a id="CapyKit_Attributes_ValueFormatAttribute__ctor_System_String_"></a> ValueFormatAttribute\(string\)
|
|
|
|
Constructor. Initializes a new instance of the <xref href="CapyKit.Attributes.ValueFormatAttribute" data-throw-if-not-resolved="false"></xref> class with
|
|
the specified format string.
|
|
|
|
```csharp
|
|
public ValueFormatAttribute(string format)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`format` [string](https://learn.microsoft.com/dotnet/api/system.string)
|
|
|
|
The format string used to format the value.
|
|
|
|
## Properties
|
|
|
|
### <a id="CapyKit_Attributes_ValueFormatAttribute_Format"></a> Format
|
|
|
|
Gets or sets the format to use for formatting the value.
|
|
|
|
```csharp
|
|
public string Format { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[string](https://learn.microsoft.com/dotnet/api/system.string)
|
|
|
|
## Methods
|
|
|
|
### <a id="CapyKit_Attributes_ValueFormatAttribute_GetFormatParameterizedString_System_Int32_"></a> GetFormatParameterizedString\(int\)
|
|
|
|
Gets a parameterized formatted string for the specified index.
|
|
|
|
```csharp
|
|
public string GetFormatParameterizedString(int index = 0)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`index` [int](https://learn.microsoft.com/dotnet/api/system.int32)
|
|
|
|
(Optional) Zero-based index of the item in the string to format.
|
|
|
|
#### Returns
|
|
|
|
[string](https://learn.microsoft.com/dotnet/api/system.string)
|
|
|
|
A formatted string with the specified index and format.
|
|
|