Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Iterate through all properties for MSProject.Task in MSProject.Tasks

$
0
0

Hi,
I am trying to iterate through all the properties of an object using System.Reflection.

Code:

/========================================/
Type _objTaskType;

PropertyInfo _objTaskProperty;

string _strTaskName = string.empty;

for(_intCouter=0; _intCouter<_objTasks.Count; _intCounter++)
{
   _objTaskType = _objTasks[_intCouter].GetType();     
   _objTaskProperty = _objTaskType.GetProperty("Name") ;   ////PROBLEM: THE OBJECT REMAINS NULL.
   _strTaskName +=    _objTaskProperty.GetValue(_objTasks[_intCouter], null) + " , ";  
}
/========================================/

I have also tried using :
/========================================/
foreach(MSProject.Task _objTask in _objTasks)
{
   _objTaskType = _objTask.GetType();     
   _objTaskProperty = _objTaskType.GetProperty("Name") ;   ////PROBLEM: STILL REMAINS NULL.
   _strTaskName +=    _objTaskProperty.GetValue(_objTasks[_intCouter], null) + " , ";  
}
/========================================/

I am able to get the values for the MSProject.Project using the same technique, however it does not seem
to work for Tasks, Resourcres etc.

Any help would be deeply appreciated.

Thanks & Regards,
Ajay Singh
--------------------------------------------------------------------------------
Thanks & Regards Ajay Singh


Thanks & Regards Ajay Singh

Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>