C#, getting a reference to a property such as CheckBox.Checked


/ Published in: C#
Save to your folder(s)

It\'s not possible to get a reference to a property in C#. A reference would allow getting/setting a property inside another function or while enumerating a list. The infoof operator would work but it doesn\'t exist yet. This code shows several ways to get a PropertyInfo for a given property. #4 is the simplest but has the disadvantage that the string will not auto-rename.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.