Gurux.DLMS.GXDLMS.CreateObject C# (CSharp) Method

CreateObject() static private method

static private CreateObject ( ObjectType type, Type>.Dictionary availableObjectTypes ) : GXDLMSObject
type ObjectType
availableObjectTypes Type>.Dictionary
return Gurux.DLMS.Objects.GXDLMSObject
        internal static GXDLMSObject CreateObject(ObjectType type, Dictionary<ObjectType, Type> availableObjectTypes)
        {
            lock (availableObjectTypes)
            {
                //Update objects.
                if (availableObjectTypes.Count == 0)
                {
                    GetObjectTypes(availableObjectTypes);
                }
                if (availableObjectTypes.ContainsKey(type))
                {
                    return Activator.CreateInstance(availableObjectTypes[type]) as GXDLMSObject;
                }
            }
            GXDLMSObject obj = new GXDLMSObject();
            obj.ObjectType = type;
            return obj;
        }