Idea for implementing reflection

2 views
Skip to first unread message

Cam: @muunkky

unread,
Jan 11, 2010, 3:26:39 PM1/11/10
to RISE
Hi,
It would be cool if the struct definitions in the C# interfaces were
defined as properties so that wrappers could use reflection. I am
trying to run the following code but the GetProperties() method
returns an empty array. I've posted the problem and the solution:

<!--Begin Code
foreach (PropertyInfo pi in typeof
(fn.DB.IBuilding.returnListResidenceByBuilding).GetProperties())
{
dsResidence.Tables["Residences"].Columns.Add(pi.Name,
pi.GetType());
}
End Code---!>

The current definition of the 'returnListResidenceByBuilding' is as
follows:

<!--Begin Code
public struct returnListResidenceByBuilding
{
public int ID;
public int Occupancy;
public string Description;
public int BuildingID;
public int Time_FrameID;
}
End Code---!>

manually changing this code to the following fixes the problem:

<!--Begin Code
public struct returnListResidenceByBuilding
{
public int ID{get;set;}
public int Occupancy{get;set;}
public string Description{get;set;}
public int BuildingID{get;set;}
public int Time_FrameID{get;set;}
}
End Code---!>

Cam: @muunkky

unread,
Jan 21, 2010, 12:05:28 PM1/21/10
to RISE
Any feedback on this idea? Pretty simple solution for massive
programming capabilities.
Reply all
Reply to author
Forward
0 new messages