I have this code segment in VB.NET:
CType(pbImageHolder.Image, Bitmap).SetPixel(curPoint.X, curPoint.Y, Color.Purple)
What is appropriate code in C#?
In VB.Net CType(object, type)
casts an object to a specific type.
There are two ways to accomplish this in C#:
Bitmap image = pbImageHolder.Image as Bitmap;
image.SetPixel(curPoint.X, curPoint.Y, Color.Purple);
or
Bitmap image = (Bitmap)(pbImageHolder.Image);
image.SetPixel(curPoint.X, curPoint.Y, Color.Purple);