You would do the same thing in C#. Just keep in mind that C# doesn't create a default instance for you automatically.
In general, though, it is a poor object oriented programming practice (regardless of what language you are using) for one object to know about the implementation of another object. In your case above, you shouldn't be exposing the TextBox1
of Form1
. Instead you should be exposing the value stored in the TextBox
. For example FirstName
as a string. This gives you the freedom to replace the TextBox
with a RichTextBox
or a ComboBox
and the users of your class wouldn't have to change their code, or even know that you changed controls.