Show / Hide Table of Contents

Class MetadataExtensions

Helper extension methods for metadata.

Inheritance
System.Object
MetadataExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Composition.Metadata
Assembly: Kephas.Core.dll
Syntax
public static class MetadataExtensions

Methods

| Improve this Doc View Source

ExtractMetadataValue<TAttribute, TValue>(Type, TValue)

Extracts the metadata value from the attribute with the provided type.

Declaration
public static TValue ExtractMetadataValue<TAttribute, TValue>(this Type type, TValue defaultValue = null)

    where TAttribute : Attribute, IMetadataValue<TValue>
Parameters
Type Name Description
System.Type type

The type.

TValue defaultValue

The default value.

Returns
Type Description
TValue

The metadata value.

Type Parameters
Name Description
TAttribute

The type of the attribute.

TValue

The type of the value.

| Improve this Doc View Source

ExtractMetadataValue<TAttribute, TValue>(Type, Func<TAttribute, TValue>, TValue)

Extracts the metadata value from the attribute with the provided type.

Declaration
public static TValue ExtractMetadataValue<TAttribute, TValue>(this Type type, Func<TAttribute, TValue> valueExtractor, TValue defaultValue = null)

    where TAttribute : Attribute
Parameters
Type Name Description
System.Type type

The type.

System.Func<TAttribute, TValue> valueExtractor

The value extractor.

TValue defaultValue

The default value.

Returns
Type Description
TValue

The metadata value.

Type Parameters
Name Description
TAttribute

The type of the attribute.

TValue

The type of the value.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX