Can you add a method to your class? If not, have you thought about using extension methods? You could create an extension method for your object type called GetPropC()
.
Example:
public static class MyExtensions
{
public static int GetPropC(this MyObjectType obj, int defaltValue)
{
if (obj != null && obj.PropertyA != null & obj.PropertyA.PropertyB != null)
return obj.PropertyA.PropertyB.PropertyC;
return defaltValue;
}
}
Usage:
int val = ObjectA.GetPropC(0); // will return PropC value, or 0 (defaltValue)
By the way, this assumes you are using .NET 3 or higher.