<p>I have this:</p>

<pre><code>public string Log
        {
            get { return log; }
            protected set
            {
                if (log != value)
                {
                    MarkModified(PropertyNames.Log, log);
                    log = value;
                }
            }

        }
</code></pre>

<p>And my utility class for databinding does this:</p>

<pre><code>PropertyInfo pi = ReflectionHelper.GetPropertyInfo(boundObjectType, sourceProperty);

if (!pi.CanWrite)
                SetReadOnlyCharacteristics(boundEditor);
</code></pre>

<p>But PropertyInfo.CanWrite does not care whether the set is publicly accessible, only that it exists.</p>

<p>How can I determine if there's a <strong>public</strong> set, not just <strong>any</strong> set?</p>

You need to use the
BindingFlags
. Something like
```
```
PropertyInfo property = type.GetProperty("MyProperty", BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.Instance);
```
```