A code that is actively developing is never static, so one possibility of why they code it this way is to move the assignment to another place in the code later if necessary. However, it sounds like it is happening inside a method, and usually I would expect that Lazy initialization is most often found for fields or properties of a class where it makes sense (because you may not know which method in the class will use it first).
Unfortunately, most likely, it will be more likely a lack of knowledge of how the Lazy function works in C # (or lazy init in general), and maybe they are just trying to use the last "cool function" that they learned about.
I saw strange or strange things that spread in the code in the company, simply because people saw that it was encoded in one direction, and then simply copied it, because they thought that the original person knew what they were doing, and thatβs has the meaning. Itβs best to ask why it was done that way. In the worst case, you will learn something about your company's procedures or coding methods. Best case, you can complete the training if they say "gee, I don't know."
source share