What is the cost of creating an object

If I need to select a static method and instantiate and use the instance method, I will always become static methods. but what are the detailed costs of instantiating?

For example, I saw a DAL that can be done with static classes, but they decided to make it an instance in the BLL with every call that they call something like.

new Customer (). GetData ();

how bad can it be?

thank

+3
source share
2 answers

. - , 500 000 1,5 .

, , new Customer().GetData(); BLL, .

, , new Customer().GetData();: Customer , - , CustomerReader (- ). , Customer , , GetData - , .

+3

CLR. (- - GC). GC ( ), , GC, . , .

, ( ) , (, / ),

- new Customer().GetData(); - , .

0

Source: https://habr.com/ru/post/1742277/


All Articles