[Lazarus] getlazarus.org search request

Anthony Walter sysrpl at gmail.com
Mon Aug 12 14:02:16 CEST 2019


In C# to define a property you write:

visibility typename propname { [visibility] get; [visibility] set; }
-or-
public int Age { get; set; }

This means you have a read write property that does nothing special. You
could also write ...

private int age;
public int Age { get { return age; } set { if (value > -1) age = value; } }

To use private a backing with code invoked to set or get. And finally you
can also write:

public int Age { get; private set; }
-or-
public int Age { get; private set; }
-or-
public int Age { get; protected set; }

To limit access to either a setter or getter of a property.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190812/8aa62311/attachment.html>


More information about the lazarus mailing list