On 9 May 2012 18:04, MB Software Solutions, LLC
<[email protected]> wrote:
> On 5/9/2012 11:24 AM, Paul Hill wrote:
>> No, you're not. This works fine:
>>
>> public class myclass
>> {
>> string Field1;
>> bool Field2;
>> }
>>
>> However, these are fields, rather than properties.
>
> Paul -- what's the difference? Are these like "private fields" for this
> class to use?
Well, they are private, but only because I made a mistake: :-)
public class myclass
{
public string Field1;
public bool Field2;
}
Fields are simpler than properties (get; set), and you have less control.
For example, a property can be read-only, or throw an exception on an
invalid value.
When databinding you must use properties.
--
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/CADwx0+KV=g10c5xgyxulkzdg_aosmajcqy_n7eq+vfmbvxj...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.