❔ QUESTION Static GETER
Would this everytime i call it create a new ContentBuilder? or just one time
15 Replies
every time.
ouf
is it possible to just do it 1 time?
sure, declare a static instance and return that
or make a singleton of sorts
and that would create to everytime a new one?
in one line not possible?
hm, not with a getter
or actually, maybe
i mean if i set it just readonly it do the same
?
public static ContentBuilder ContentBuilder { get; } = new("content");
that should work👍
readonly
would give you a similar development experience, yesand it get not created everytime i call it or?
nope.
just the once
👍
thx for your help
just to visualize this..
this will print "once" once and "many" three times
👍
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.