In the following code, it seems a new object is created while concurrently calling a method (Resize
) on that object:
Image<Bgr, Byte> img = new Image<Bgr, Byte>(fileNameTextBox.Text).Resize(400, 400, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR, true);
Is what I described the correct interpretation of what is happening? What is the name in the C# world for this type of usage?
No, it's not doing it concurrently at all. It creates the object, then calls the method - and then assigns the result of the method call to the variable. So it's equivalent to this:
var tmp = new Image<Bgr, Byte>(fileNameTextBox.Text);
Image<Bgr, Byte> img = tmp.Resize(400, 400, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR, true);
There's no specific name for this - it's reminiscent of the builder pattern, although it's not clear from your example whether Resize
modifies the existing object and returns this
, or whether it creates a new object with the appropriate resize operation performed.
See more on this question at Stackoverflow