Properties and Fields
When working with .NET objects, we may alter them not only by using methods, but also by accessing properties and fields that the object has. In most cases, properties and fields share the same syntax for their access. However, there are some significant differences in their implementation in .NET.
Properties
The encapsulation principles suggest that we store the data inside our instances in private fields (private members[2]) and we access this data through special accessor and mutator methods. .NET implements these principles by introducing the notion of properties. We access properties through the hash-reference syntax. We assign values to properties or read their values, but actually, .NET calls for us special getter ...
Get Programming PERL in the .NET Environment now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.