[Solved] Why does C# allow creating an object with the same reference? [closed]


How’s this possible?

The Name property on a Control is just a string property – you can assign it anything you want, so having multiple controls with the same name is just the same as having multiple text boxes displaying the same text, or any other class with a string property.

Note that, in your case, you’re not actually using or storing the PictureBox you create in any way, so it’s going to be eligible for GC as soon as your method ends.

2

solved Why does C# allow creating an object with the same reference? [closed]