public T Add <T>() where T : Component { ComponentHelper.Assert <T>(); /*if (!ComponentHelper.AllowMultiple<T>() && Handle.Has<T>()) { * throw new Exception($"Already has a component of type {typeof(T).Name}"); * } * T component = Activator.CreateInstance<T>(); * component.AppendTo(this); * Events.RaiseAddedComponent(component); * var registerAs = ComponentHelper.GetRegisterAs<T>(); * if (registerAs != null) { * registerAs.CallSet(Handle, component); * } else { * Handle.Set(component); * } * return component;*/ T component = Activator.CreateInstance <T>(); ComponentHelper.CallSet(Handle, component); component.AppendTo(this); Events.RaiseAddedComponent(component); return(component); }