Resource.Set
Contents
[
Hide
]Set<T>(Key<T, RscKey>, T)
Maps the specified property to the specified value in this container.
public void Set<T>(Key<T, RscKey> key, T val)
Parameter | Description |
---|---|
T | the type of the mapped value. |
key | the specified property key. Rsc for getting the property key. |
val | the value. |
Examples
Shows how to read/write common resource properties.
var project = new Project(DataDir + "UpdateResourceData.mpp");
// Add resource and set some properties
var resource = project.Resources.Add("Rsc");
resource.Set(Rsc.Start, new DateTime(2020, 4, 1, 8, 0, 0));
resource.Set(Rsc.StandardRate, 30);
resource.Set(Rsc.OvertimeRate, 45);
resource.Set(Rsc.Group, "Workgroup1");
Console.WriteLine("Resource Start: " + resource.Get(Rsc.Start));
Console.WriteLine("Resource Standard Rate: " + resource.Get(Rsc.StandardRate));
Console.WriteLine("Resource Overtime Rate: " + resource.Get(Rsc.OvertimeRate));
Console.WriteLine("Resource Group: " + resource.Get(Rsc.Group));
project.Save(OutDir + "UpdateResourceData_out.mpp", SaveFileFormat.Mpp);
See Also
- struct Key<T,K>
- enum RscKey
- class Resource
- namespace Aspose.Tasks
- assembly Aspose.Tasks
Set(Key<DateTime, RscKey>, DateTime)
Maps the specified property to the specified value in this container.
public void Set(Key<DateTime, RscKey> key, DateTime val)
Parameter | Type | Description |
---|---|---|
key | Key`2 | the specified property key. Rsc for getting the property key. |
val | DateTime | the value. |
Examples
Shows how to read/write common resource properties.
var project = new Project(DataDir + "UpdateResourceData.mpp");
// Add resource and set some properties
var resource = project.Resources.Add("Rsc");
resource.Set(Rsc.Start, new DateTime(2020, 4, 1, 8, 0, 0));
resource.Set(Rsc.StandardRate, 30);
resource.Set(Rsc.OvertimeRate, 45);
resource.Set(Rsc.Group, "Workgroup1");
Console.WriteLine("Resource Start: " + resource.Get(Rsc.Start));
Console.WriteLine("Resource Standard Rate: " + resource.Get(Rsc.StandardRate));
Console.WriteLine("Resource Overtime Rate: " + resource.Get(Rsc.OvertimeRate));
Console.WriteLine("Resource Group: " + resource.Get(Rsc.Group));
project.Save(OutDir + "UpdateResourceData_out.mpp", SaveFileFormat.Mpp);
See Also
- struct Key<T,K>
- enum RscKey
- class Resource
- namespace Aspose.Tasks
- assembly Aspose.Tasks