title: What is type in App.config custom section
body: <p>I am new in C# custom configuration.</p>
  
  <p>I want to do a simple example.
  I tried this: <a href="https://stackoverflow.com/a/14890095/6121574">https://stackoverflow.com/a/14890095/6121574</a>
  But, I access configuration file like this: <a href="https://stackoverflow.com/a/25806445/6121574">https://stackoverflow.com/a/25806445/6121574</a></p>
  
  <p>Now I get
  An unhandled exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll 
  ...Could not load file or assembly My.Assembly</p>
  
  <p>My question is: What is My.Assembly in App.config file? How to make my code work?</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Configuration;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  
  
  namespace My
  {
      public class MyConfigSection : ConfigurationSection
      {
          [ConfigurationProperty("", IsRequired = true, IsDefaultCollection = true)]
          public MyConfigInstanceCollection Instances
          {
              get { return (MyConfigInstanceCollection)this[""]; }
              set { this[""] = value; }
          }
      }
      public class MyConfigInstanceCollection : ConfigurationElementCollection
      {
          protected override ConfigurationElement CreateNewElement()
          {
              return new MyConfigInstanceElement();
          }
  
          protected override object GetElementKey(ConfigurationElement element)
          {
              //set to whatever Element Property you want to use for a key
              return ((MyConfigInstanceElement)element).Name;
          }
      }
  
      public class MyConfigInstanceElement : ConfigurationElement
      {
          //Make sure to set IsKey=true for property exposed as the GetElementKey above
          [ConfigurationProperty("name", IsKey = true, IsRequired = true)]
          public string Name
          {
              get { return (string)base["name"]; }
              set { base["name"] = value; }
          }
  
          [ConfigurationProperty("code", IsRequired = true)]
          public string Code
          {
              get { return (string)base["code"]; }
              set { base["code"] = value; }
          }
      }
  
      class Program
      {
  
  
          static void Main(string[] args)
          {
              var config = ConfigurationManager.GetSection("registerCompanies")
                    as MyConfigSection;
  
              foreach (MyConfigInstanceElement e in config.Instances)
              {
                  Console.WriteLine("Name: {0}, Code: {1}", e.Name, e.Code);
              }
  
          }
      }
  }
  </code></pre>
  
  <p>My App.config</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="registerCompanies"
               type="My.MyConfigSection, My.Assembly" /&gt;
    &lt;/configSections&gt;
    &lt;registerCompanies&gt;
      &lt;add name="Tata Motors" code="Tata"/&gt;
      &lt;add name="Honda Motors" code="Honda"/&gt;
    &lt;/registerCompanies&gt;
  &lt;/configuration&gt;
  </code></pre>