First of all I am new to C# programming.
I read the parameter of
ImageObj.getBounds(ref GraphicsUnit unit);
When I tried this,
ImageObj.getBounds(ref GraphicsUnit.Pixel);
I still got the error. But this seemed to work perfectly fine.
GraphicsUnit u = GraphicsUnit.Pixel;
ImageObj.getBounds(ref u);
What is the difference between the two and how is the first wrong? Thank You.
GraphicsUnit.Pixelis a property, you can not pass properties withref/outparameters in C#. It’s becauseref/outis like pointer to pointer in other languages but property is not a variable – it’s a 2 methods: getter and setter, so, you can’t pass a pointer to pointer to value because you haven’t value itself.Added:
Ok,
GraphicsUnit.Pixelactually is anenummember – you also can’t pass it withref/outparameters because it’s a constant.