Example #1
0
 /// <summary>
 /// Returns the first created 'InstanceRegister' object or creates one, if none was declared before.
 /// </summary>
 /// <returns>First created InstanceRegister object in runtime.</returns>
 public static InstanceRegister GetFirstInstanceRegister()
 {
     if (firstInstanceRegister == null)
     {
         firstInstanceRegister = new InstanceRegister();
     }
     return(firstInstanceRegister);
 }
Example #2
0
        /// <summary>
        /// Initialize new instance register with predefined collection.
        /// </summary>
        /// <exception cref="ArgumentNullException">Dictionary contains one or more duplicate keys.</exception>
        /// <param name="collection">A predefined collection.</param>
        public InstanceRegister(IEnumerable <KeyValuePair <string, Dictionary <string, object> > > dictionary)
        {
            // Init register with collection if given or not if not given.
            registers = (dictionary != null)
                ? new Dictionary <string, Dictionary <string, object> >(dictionary)
                : new Dictionary <string, Dictionary <string, object> >();

            // Declare first InstanceRegister to Type if none declared before.
            if (firstInstanceRegister == null)
            {
                firstInstanceRegister = this;
            }
        }