CustomProjectPropertyCollection Class |
Namespace: Aspose.Tasks.Properties
The CustomProjectPropertyCollection type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | CustomProjectPropertyCollection |
Initializes a new instance of the CustomProjectPropertyCollection class.
|
Name | Description | |
---|---|---|
![]() ![]() | Count |
Gets the number of properties in the collection.
(Inherited from PropertyKeyedCollectionT.) |
![]() ![]() | IsReadOnly |
Gets a value indicating whether this collection is read-only; otherwise, false.
(Overrides PropertyKeyedCollectionTIsReadOnly.) |
![]() ![]() | Item |
Gets the Property associated with the specified key.
(Inherited from PropertyKeyedCollectionT.) |
![]() ![]() | Names |
Gets the collection of all property names.
(Inherited from PropertyKeyedCollectionT.) |
Name | Description | |
---|---|---|
![]() ![]() | Add(T) |
Creates a new custom property.
(Inherited from PropertyKeyedCollectionT.) |
![]() ![]() | Add(String, Boolean) |
Creates a new custom property.
|
![]() ![]() | Add(String, DateTime) |
Creates a new custom property.
|
![]() ![]() | Add(String, Double) |
Creates a new custom property.
|
![]() ![]() | Add(String, String) |
Creates a new custom property.
|
![]() ![]() | Clear |
Clears the PropertyCollection.
|
![]() ![]() | Contains |
Determines whether the PropertyCollectionT contains a property with the specified name.
(Inherited from PropertyKeyedCollectionT.) |
![]() | Equals | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() ![]() | Remove |
Removes a property with the specified name from the collection.
|
![]() | ToString | (Inherited from Object.) |
var project = new Project(DataDir + "ReadProjectInfo.mpp"); Console.WriteLine("Is custom properties collection read-only?: " + project.CustomProps.IsReadOnly); // lets add new custom properties // collection support Boolean, DateTime, Double, String types project.CustomProps.Add("IsEnterprise", true); project.CustomProps.Add("Project Start Date", new DateTime(2020, 4, 16, 8, 0, 0)); project.CustomProps.Add("Precision", 10d); project.CustomProps.Add("Custom Name", "MyProject"); // custom properties are available through the typed collection Console.WriteLine("Count of custom properties: " + project.CustomProps.Count); foreach (var property in project.CustomProps) { Console.WriteLine(property.Type); Console.WriteLine(property.Name); Console.WriteLine(property.Value); Console.WriteLine(); } // get a custom property value Console.WriteLine("Custom Name: " + project.CustomProps["Custom Name"]); // iterate over names of custom properties foreach (var propsName in project.CustomProps.Names) { Console.WriteLine("Name: " + propsName); Console.WriteLine(); } // one can delete a value by string key if (project.CustomProps.Contains("Custom Name")) { project.CustomProps.Remove("Custom Name"); } // or one can clear collection completely project.CustomProps.Clear();