You should definitely use the method because accessing this member does something. Calling a method is a good way for the code to speak on its own in this regard.
Or, if you prefer a different perspective: two subsequent member accesses return different results. A good rule is to use the method whenever this occurs, so as not to violate the principle of least surprise .
This is like reading the result of a variable, even if you know that NewTRequired is a property (as opposed to a field), you also know that it actually executes arbitrary code:
var prototype = Factory.NewTRequired;
I intentionally put the result in a variable called prototype to better show that even an informed reader of this code can be easily discarded: it would be unreasonable to see this and think โrightโ, so NewTRequired is the prototype of the object for X. โThis reader was undoubtedly would be amazed at the result of this code:
var eq = object.ReferenceEquals(prototype, Factory.NewTRequired);
Contrast this with the factory method. Now this code may give a little smell:
And this code will never surprise you:
A famous example of where this rule really should be followed, but was not , is DateTime.Now .
source share