When working with a set of forms that a user must go through, is it better to transfer data when creating a new instance of this form or is it better to call a function from the previous form? I have code written that calls the previous procedure, and looks ugly, and I canβt remember why it was done that way. The only reason I could come up with was that the data was large, and there was a good chance that the user would not use the data, except in a special case.
If you put all your shared data in a class and then pass a reference to an instance of this class to the constructor in each form, it does not matter how big the data is, because it is only a link every time.
This has the advantage that your forms are not attached to each other.
This is a subjective question for the most part. I personally took a route that seemed more convenient for people who would have to deal with my code later. I would like to create an instance of the form, load the public properties with what I was trying to pass, and then make the view visible. Thus, anyone who edited the new form knew that all the data was preloaded. Anyone who edited the "old" form knew where to load any new properties.
, , , .
, , server.transfer Server.Transfer : http://www.dotnet-guide.com/servertransfer.html
, . . , .
, , - , ββ SQLServer MS-Access, , , , . .. , , , .., .
winforms ( -), , , . ( , ). .
singleton singleton class.
, , , , ... .
Source: https://habr.com/ru/post/1709187/More articles:Flex / Flash: how to embed the same font in multiple SWC - flexLoading a 32-bit process in a 64-bit environment - javascriptHow to create a delete command for a Windows-based application in the application folder - vb.netHow to connect from Ruby to MS Sql Server - ruby ββ| fooobar.comHow to pass an object in int to converter? - c #Why doesn't this ActiveRecord link work? - ruby-on-railsHow to get groups included in an ActiveDirectory group using C #? - c #CAML cannot reference custom properties in custom fields - sharepointCan I create read-only items in SOAP web services? - c #LinqDataSource and DateTime format - sqlAll Articles