Edit: I'm going to try to lay this all out, because I see this question coming up over and over. Feel free to edit and contribute to my answer.
The standard coding design standard is :
Consider this extreme example:
Car c = new Car();
Console.WriteLine( c.Color );
By just writing that code above, would you expect the property Color to be doing this:
public string Color {
get{
CarFactory cf = new CarFactory();
cf.AddWheels();
cf.AddSteeringWheel();
cf.AddEngine();
cf.PaintCar( Color.Red );
return cf.BuildCar().Color;
}
}
It's sneaky hidden code that you wouldn't think to be there.
But it would make total sense if the same code where:
Car c = CarFactory.BuildNewCar();
c.Color = Color.Red;
While looking for documentation for you I ran accross: http://msdn.microsoft.com/en-us/library/ms229006.aspx
Which says (rather vaguely): "...properties should not be computationally complex or produce side effects."
It also states "If a getter might throw an exception, consider redesigning the property to be a method."
While it is completely possible that an exception could be thrown while using the COM object in your getter, in this case I do not think it would be good design to wrap it in a method. Especially if the wrapper is temporary and the COM object will be replaced later with managed code. It will keep your API consistent in the future without needing to change it.
Error checking omitted:
public class Wrapper {
private COMObject _comObj;
public Wrapper() {
_comObj = [Create your Com Object here].
}
public string Name {
get
{
return _comObj.getName();
}
}
}