Search Results for

    Show / Hide Table of Contents

    Class ConstructionAttribute

    Attribute that can be attached to a constructor or factory method, to provide information about how to set the parameters of the constructor/method to copy an instance of the object. For example, it can indicate that the parameters correspond to properties of the object.

    Inheritance
    Object
    Attribute
    ConstructionAttribute
    Implements
    IComparable
    Inherited Members
    Attribute.Equals(Object)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, Boolean)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, Boolean)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, Boolean)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, Boolean)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, Boolean)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, Boolean)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, Boolean)
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, Boolean)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, Boolean)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module, Type, Boolean)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, Boolean)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, Boolean)
    Attribute.GetHashCode()
    Attribute.IsDefaultAttribute()
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, Boolean)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, Boolean)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, Boolean)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, Boolean)
    Attribute.Match(Object)
    Attribute.TypeId
    Object.Equals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Microsoft.ML.Probabilistic.Serialization
    Assembly: Microsoft.ML.Probabilistic.dll
    Syntax
    [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method)]
    public class ConstructionAttribute : Attribute, IComparable

    Constructors

    ConstructionAttribute()

    Declaration
    public ConstructionAttribute()

    ConstructionAttribute(String[])

    Declaration
    public ConstructionAttribute(params string[] parameters)
    Parameters
    Type Name Description
    String[] parameters

    Fields

    TargetMember

    The construction method

    Declaration
    public MemberInfo TargetMember
    Field Value
    Type Description
    MemberInfo

    Properties

    Params

    The names of the properties, fields or methods to call on an object instance to get parameter values to construct a duplicate of that instance.

    Declaration
    public string[] Params { get; }
    Property Value
    Type Description
    String[]

    UseWhen

    The name of a boolean property or method on the object instance which indicates when this construction method should be used.

    Declaration
    public string UseWhen { get; set; }
    Property Value
    Type Description
    String
    Remarks

    There are often special case constructors or factory methods which apply when an object is in a particular state e.g. when a distribution is uniform.
    This parameter allows a constructor to be used only when the object is in a state, as indicated by a bool property or method e.g. IsUniform().

    Methods

    CompareTo(Object)

    Declaration
    public int CompareTo(object obj)
    Parameters
    Type Name Description
    Object obj
    Returns
    Type Description
    Int32

    GetConstructionAttribute(Type)

    Declaration
    public static List<ConstructionAttribute> GetConstructionAttribute(Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    List<ConstructionAttribute>

    GetParamValue(Int32, Object, out Type)

    Gets the value of the constructor parameter at the given index needed to reconstruct the supplied instance.

    Declaration
    public object GetParamValue(int paramIndex, object instance, out Type type)
    Parameters
    Type Name Description
    Int32 paramIndex

    The parameter index

    Object instance

    The instance

    Type type

    Type of the parameter (output)

    Returns
    Type Description
    Object

    Implements

    System.IComparable
    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.