Supposing I have a class “Item”, which has three member variables: string name, decimal quantity and string unit. I have got public get/set properties on all three.
Sometimes, I want to display quantity as text along with correct unit, eg. 10m or 100 feet.
My question is, is it possible to have some sort of ToString() function for properties too, so that their text output can be customized?
Thanks,
Saurabh.
What you can do is to make a new (readonly) property returning a formatted version: