Reduces the loss caused by NullReferenceException
I wrote a blog by ILoveSleep a few days ago. "I criticized many bloggers, but I don't think I should say something ugly to a blog. After all, ILoveSleep just shared his thoughts, if you have any questions, let's say that he is also very modest in his reply to everyone. He must be a person who can accept others' opinions. Today, I also want to say that NullReferenceException can be sprayed on everyone. I am not afraid of this person.
I don't have ILoveSleep so much patience to explain to you. At the same time, the Code is very simple, so I directly paste the code.
Class
PreventNull<T> : Lazy<T> PreventNull() : PreventNull( isThreadSafe) : PreventNull(Func<T> valueFactory) : PreventNull(LazyThreadSafetyMode mode) : PreventNull(Func<T> valueFactory, isThreadSafe) : PreventNull(Func<T> valueFactory, LazyThreadSafetyMode mode) : T(PreventNull<T> PreventNull<T> PreventNull<T>( Func<T>(() => { (.Value == (NullErrorLog != NullErrorLog( Action<PreventNull<T>> NullErrorLog { ; Func<T> NullDefaltValue { ; }
Main( Person p1 = PreventNull<Person>( Func<Person>(() => { Person() { Name = = PreventNull<Person>( Func<Person>(() => { Person p4 = (PreventNull<Person>) Person() { Name = = PreventNull<Person>( Func<Person>(() => { = (PreventNull<Person> PreventNull<Person>.NullErrorLog = Action<PreventNull<Person>>((p) => { Console.WriteLine(<Person>.NullDefaltValue = Func<Person>(() => { Person() { Name = Name { ;