Click here to Skip to main content
14,454,377 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: C# code survey Pin
Hooga Booga31-Oct-18 2:41
MemberHooga Booga31-Oct-18 2:41 
GeneralRe: C# code survey Pin
Eddy Vluggen30-Oct-18 3:03
professionalEddy Vluggen30-Oct-18 3:03 
GeneralRe: C# code survey Pin
Super Lloyd30-Oct-18 3:29
MemberSuper Lloyd30-Oct-18 3:29 
GeneralRe: C# code survey Pin
Eddy Vluggen30-Oct-18 3:33
professionalEddy Vluggen30-Oct-18 3:33 
GeneralRe: C# code survey Pin
Marc Clifton30-Oct-18 3:53
communityengineerMarc Clifton30-Oct-18 3:53 
GeneralRe: C# code survey Pin
Dan Neely30-Oct-18 3:55
MemberDan Neely30-Oct-18 3:55 
JokeRe: C# code survey Pin
Foothill30-Oct-18 5:26
professionalFoothill30-Oct-18 5:26 
GeneralRe: C# code survey Pin
Gary Wheeler30-Oct-18 7:29
MemberGary Wheeler30-Oct-18 7:29 
public class Foo
{
  public class DTO
  {
    public T1 P1 { set; get; } = P1_default_value;
...
    public T24 P24 { set; get; } = P24_default_value;
  }

  public void In(DTO dto)
  {
    // Set _P* from dto.P*
  }

  public DTO Out()
  {
    DTO dto = new DTO();

    // set dto.P* from _P*

    return dto;
  }

  private T1 _P1;
...
  private T24 _P24;
}
The DTO object constructs itself with a consistent default set of values. The DTO property accessors are responsible for maintaining consistency of that set. The In and Out methods of the Foo class manage its internal state based on accepting or producing a DTO, respectively. This approach lets you do things like this:
Foo foo = new Foo();
...
foo.In(new DTO() { P3 = Fred, P17 = Wilma; });
Foo foo2 = new Foo();
foo2.In(foo.Out());

Software Zen: delete this;

GeneralRe: C# code survey Pin
Rob Philpott30-Oct-18 7:34
MemberRob Philpott30-Oct-18 7:34 
GeneralRe: C# code survey Pin
ScottM131-Oct-18 0:10
MemberScottM131-Oct-18 0:10 
GeneralRe: C# code survey Pin
Sander Rossel31-Oct-18 1:49
professionalSander Rossel31-Oct-18 1:49 
GeneralRe: C# code survey Pin
DerekT-P31-Oct-18 2:31
professionalDerekT-P31-Oct-18 2:31 
GeneralRe: C# code survey Pin
Super Lloyd31-Oct-18 7:38
MemberSuper Lloyd31-Oct-18 7:38 
GeneralRe: C# code survey Pin
DerekT-P31-Oct-18 9:34
professionalDerekT-P31-Oct-18 9:34 
GeneralRe: C# code survey Pin
Super Lloyd31-Oct-18 10:12
MemberSuper Lloyd31-Oct-18 10:12 
GeneralRe: C# code survey Pin
jhunley31-Oct-18 4:37
Memberjhunley31-Oct-18 4:37 
GeneralRe: C# code survey Pin
michaelakin31-Oct-18 5:08
Membermichaelakin31-Oct-18 5:08 
GeneralRe: C# code survey Pin
michaelakin31-Oct-18 5:08
Membermichaelakin31-Oct-18 5:08 
GeneralRe: C# code survey Pin
jhunley31-Oct-18 5:17
Memberjhunley31-Oct-18 5:17 
GeneralRe: C# code survey Pin
michaelakin31-Oct-18 5:29
Membermichaelakin31-Oct-18 5:29 
GeneralRe: C# code survey Pin
jhunley31-Oct-18 6:00
Memberjhunley31-Oct-18 6:00 
GeneralRe: C# code survey Pin
Bruce Patin31-Oct-18 4:44
MemberBruce Patin31-Oct-18 4:44 
GeneralRe: C# code survey Pin
michaelakin31-Oct-18 5:19
Membermichaelakin31-Oct-18 5:19 
AnswerRe: C# code survey Pin
Leonardo Pessoa31-Oct-18 7:43
MemberLeonardo Pessoa31-Oct-18 7:43 
GeneralRe: C# code survey Pin
Leng Vang31-Oct-18 9:06
MemberLeng Vang31-Oct-18 9:06 

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.