Lazy Loading Objects in C-Sharp [Speed Complexity]


Dot Net Lazy Loading Class

When developing a Software or any other application, keep in mind how the data is being loaded. Bad practice is calling a function in the constructor, this is bad because data might end uploaded without need. The solution to this is creating properties in the class e.g. public void getObject(){thy shall return something;} this way, you only load object when in need. If the Get-Function returns a list of Objects, you can even do this: foreach(var o in Instance.getObject()){//do something here}, remember if you want to just load the object from the List or Dictionary use "foreach" instead of "for" Loop.

The idea here is to only load objects that you need, instead of overloading the system with a bunch of data that is not needed at that time. However, Dot-Net has included an inbuilt class called "Lazy" in order to implement this class just wrap your function; public void List

C-Sharp
published
v.0.01




For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email AddressContact: [email protected]