Class EntityFieldAttribute

EntityFieldAttribute class

Represents an attribute for entity properties.

[AttributeUsage(AttributeTargets.Property)]
public class EntityFieldAttribute : Attribute

Constructors

NameDescription
EntityFieldAttribute()The default constructor.

Remarks

Attribute used for Task, Resource, Project and ResourceAssignment entity properties only, and simplifies it’s enumeration.

Examples

How to enumerate properties using EntityField attribute:

[C#]
var project = new Project("sample.mpp");
foreach (var task in project.SelectAllChildTasks())
{
    Console.WriteLine("Task:");
    foreach (var propInfo in typeof(Task).GetProperties().Where(propInfo => propInfo.GetCustomAttribute{Attributes.EntityFieldAttribute}() != null))
    {
        Console.WriteLine(string.Format("{0}: {1}", propInfo.Name, propInfo.GetValue(task)));
    }
}

See Also