Horje
C# setting property values through reflection with attributes Code Example
C# setting property values through reflection with attributes
PropertyInfo[] properties = typeof(MyClass).GetProperties();
foreach(PropertyInfo property in properties)
{
    StoredDataValueAttribute attribute =
        Attribute.GetCustomAttribute(property, typeof(StoredDataValueAttribute)) as StoredDataValueAttribute;

    if (attribute != null) // This property has a StoredDataValueAttribute
    {
         property.SetValue(instanceOfMyClass, attribute.DataValue, null); // null means no indexes
    }
}




Csharp

Related
add row and columns to grid wpf in code Code Example add row and columns to grid wpf in code Code Example
get position of gameobject unity Code Example get position of gameobject unity Code Example
c# lambdas Code Example c# lambdas Code Example
C# linq mselect Code Example C# linq mselect Code Example
group-by-in-linq Code Example group-by-in-linq Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10