Click here to Skip to main content
15,904,153 members
Home / Discussions / C#
   

C#

 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Richard Deeming20-Oct-17 2:12
mveRichard Deeming20-Oct-17 2:12 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Eddy Vluggen20-Oct-17 4:31
professionalEddy Vluggen20-Oct-17 4:31 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Richard Deeming20-Oct-17 4:43
mveRichard Deeming20-Oct-17 4:43 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Eddy Vluggen20-Oct-17 6:01
professionalEddy Vluggen20-Oct-17 6:01 
AnswerRe: Subjective question: which one of these Lazy Init is best Pin
Super Lloyd20-Oct-17 20:31
Super Lloyd20-Oct-17 20:31 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Super Lloyd20-Oct-17 20:32
Super Lloyd20-Oct-17 20:32 
AnswerRe: Subjective question: which one of these Lazy Init is best Pin
jschell20-Oct-17 9:22
jschell20-Oct-17 9:22 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Eddy Vluggen20-Oct-17 14:18
professionalEddy Vluggen20-Oct-17 14:18 
jschell wrote:
All three methods require a comparison for every access of the property.
The basic idea of a singleton; do we have an object? If not, make one. Return it.

The OP doesn't specifically request a singleton, otherwise I could point to the "static" modifier, but still for practical purposes seems to be used in that way.

jschell wrote:
Since it should always be defined then the set semantics and ctors should define that rather than the get.
Nah, a property that defines a getter is going to return a value, and in the exceptional case of an error it will raise an exception. Which parts of those semantics are unclear?

A get (property) can be part of an Interface. It demands you keep your promises Thumbs Up | :thumbsup:
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]

GeneralRe: Subjective question: which one of these Lazy Init is best Pin
jschell23-Oct-17 6:02
jschell23-Oct-17 6:02 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Eddy Vluggen23-Oct-17 6:25
professionalEddy Vluggen23-Oct-17 6:25 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
jschell25-Oct-17 9:07
jschell25-Oct-17 9:07 
AnswerRe: Subjective question: which one of these Lazy Init is best Pin
Super Lloyd20-Oct-17 20:40
Super Lloyd20-Oct-17 20:40 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Bernhard Hiller23-Oct-17 22:28
Bernhard Hiller23-Oct-17 22:28 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Super Lloyd24-Oct-17 1:04
Super Lloyd24-Oct-17 1:04 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Richard Deeming24-Oct-17 1:53
mveRichard Deeming24-Oct-17 1:53 
AnswerRe: Subjective question: which one of these Lazy Init is best Pin
BillWoodruff20-Oct-17 18:10
professionalBillWoodruff20-Oct-17 18:10 
QuestionRe: Subjective question: which one of these Lazy Init is best Pin
Super Lloyd20-Oct-17 20:52
Super Lloyd20-Oct-17 20:52 
AnswerRe: Subjective question: which one of these Lazy Init is best Pin
BillWoodruff20-Oct-17 22:42
professionalBillWoodruff20-Oct-17 22:42 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Super Lloyd20-Oct-17 23:01
Super Lloyd20-Oct-17 23:01 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
BillWoodruff21-Oct-17 0:44
professionalBillWoodruff21-Oct-17 0:44 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
Super Lloyd21-Oct-17 1:21
Super Lloyd21-Oct-17 1:21 
QuestionRe: Subjective question: which one of these Lazy Init is best Pin
Super Lloyd20-Oct-17 21:10
Super Lloyd20-Oct-17 21:10 
AnswerRe: Subjective question: which one of these Lazy Init is best Pin
Sascha Lefèvre21-Oct-17 2:54
professionalSascha Lefèvre21-Oct-17 2:54 
GeneralRe: Subjective question: which one of these Lazy Init is best Pin
BillWoodruff22-Oct-17 6:08
professionalBillWoodruff22-Oct-17 6:08 
QuestionAttributes on fields in a DataTable/DataRow Pin
hpjchobbes18-Oct-17 10:27
hpjchobbes18-Oct-17 10:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.