I just have a few questions in my head ...
Is it good to create an object without a link, as shown below. If so, why?
LoadIt(new myClass()); where LoadIt is some method
LoadIt(new myClass());
What happens to the object created above. Will it be garbage collection. If yes, then when? those. its scope is the same as other objects.
Is it possible to transfer the same object again?
The area is determined by the method (here LoadIt) ...
Load it myClass , , , ... .. , ...
, Stack... ... LoadIt ... , , Load it method ... LoadIt ... , ( ) , ...
, , Load it ... , , ... , , .
2) , ( ) , .
3) . , LoadIt.
LoadIt
public MyClass LoadIt(MyClass myClass) { ... do somthing return myClass; }
.
, ( # 3) MyClass .
, var a = new MyClass(). GCed , ; , GC .
var a = new MyClass()
. , , LoadIt .
, # 2, , . , . , , - , ( , 5 GC-, , , CPU).
1) , , , , . , .
2) Any managed code is garbage collection, so yes, it will be garbage collection, and when the CLR is determined.
3) yes, you can refer to it in the LoadIt method, but not outside of LoadIt.
Source: https://habr.com/ru/post/1733304/More articles:jquery apply attribute only to first element? - jquerySuggestions for SCORM player + API or Java library and player in Flash - javaHow to verify that a block has been assigned? - ruby | fooobar.comRails: javascript conditional tag executed locally, includes - javascriptjQuery file browser and django - jqueryКак использовать printf в C и что должен мой код печатать? - cIgnore case when running xsl: sort - xmlEnhance Regular Expressions - c ++Creating exception classes for different error codes - c #Unable to create MoveConstructibles map - c ++All Articles