Auto-Implemented Properties c#

Posted by user311130 on Stack Overflow See other posts from Stack Overflow or by user311130
Published on 2010-05-25T08:57:05Z Indexed on 2010/05/25 9:01 UTC
Read the original article Hit count: 273

Filed under:

Hi all,

  1. could someone explain me what's the idea behind using Auto-Implemented Properties c#?

public class Customer { public int ID { get; set; } public string Name { get; set; } }

I get the motivation to use properties for private field, so we can determine how one can access a private field. But here - it's just like defining the field to be public from the first place. no?

  1. Is there a difference between defining a field to be "public const" or define it to have a get-only property ?

Thanks

Elad

© Stack Overflow or respective owner

Related posts about c#