Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In order to better understand what's happening <em>under the hood</em>, I recommend you to install <a href="http://ilspy.net/" rel="nofollow">ILSpy</a>. Open <code>System.Windows.Forms</code> from the GAC and take a look at the <code>Control</code> class.</p> <p>The exhibit B <strong>will work</strong> because the <code>Controls</code> property of the <code>System.Windows.Form.Control</code> class contains all the controls, disregarding their modifiers:</p> <pre><code>public Control.ControlCollection Controls { get { Control.ControlCollection controlCollection = (Control.ControlCollection)this.Properties.GetObject(Control.PropControlsCollection); if (controlCollection == null) { controlCollection = this.CreateControlsInstance(); this.Properties.SetObject(Control.PropControlsCollection, controlCollection); } return controlCollection; } } </code></pre> <p>Where <code>CreateControlsInstance</code> is:</p> <pre><code>protected virtual Control.ControlCollection CreateControlsInstance() { return new Control.ControlCollection(this); } </code></pre> <p>So the <code>System.Windows.Forms.Control.ControlCollection.Find</code> method, which is <code>public</code>, searches the specidfied control name over the <strong>whole</strong> control collection:</p> <pre><code>public Control[] Find(string key, bool searchAllChildren) { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException("key", SR.GetString("FindKeyMayNotBeEmptyOrNull")); } ArrayList arrayList = this.FindInternal(key, searchAllChildren, this, new ArrayList()); Control[] array = new Control[arrayList.Count]; arrayList.CopyTo(array, 0); return array; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload