/// <summary>
        /// Method to raise the PropertyChangedEventHandler for the CncApi properties
        /// </summary>
        /// <param name="EVENT_HANDLER_CLASS">The object whose properties are to be checked</param>
        /// <param name="CNCSERVER_METHOD">Some CncServer methods are not returning pointers. Every time that you check the properties this method will also run. Note: Only needed if the method from the cncserver does not return a pointer.</param>
        /// <param name="CNCSERVER_METHOD_ARGS">Arguments for the CncServer Methods</param>
        /// <param name="CNCSERVER_OBJ">Object where the CncMethod is located. If the method is static this value can be null.</param>
        /// <param name="SELECTED_PROPERIES">Properties to check</param>

        public NotifyCncApiPropertyChanged(T EVENT_HANDLER_CLASS, MethodInfo CNCSERVER_METHOD = null, object[] CNCSERVER_METHOD_ARGS = null, object CNCSERVER_OBJ = null, PropertyInfo[] SELECTED_PROPERIES = null)
        {
            EventHandlerClass = EVENT_HANDLER_CLASS;
            Type ClassType = EventHandlerClass.GetType();

            CncServerMethod = CNCSERVER_METHOD;
            CncServerArgs   = CNCSERVER_METHOD_ARGS;

            if (SELECTED_PROPERIES != null && SELECTED_PROPERIES.Length > 0)
            {
                AllProperties = SELECTED_PROPERIES;
            }
            else
            {
                //skip all properties where the property has namespace from the cncapi codewrapper and if its not an enum. The reason is that these properties will never change in the wrapper. You can bypass this restriction by setting in the contructor the propertyinfo.
                AllProperties = ClassType.GetProperties().Where((Class) =>
                {
                    bool Return         = false;
                    Type TypeOfProperty = Class.PropertyType;

                    if (TypeOfProperty.IsArray == true)
                    {
                        Type ElementType = TypeOfProperty.GetElementType();

                        if (ElementType.Namespace != CodeWrapperNameSpace || ElementType.IsEnum == true)
                        {
                            Return = true;
                        }
                    }
                    else if (TypeOfProperty.Namespace != CodeWrapperNameSpace || TypeOfProperty.IsEnum == true)
                    {
                        Return = true;
                    }
                    return(Return);
                }).ToArray();
            }
            PropertiesCache       = new object[AllProperties.Length];
            PropertyChangedMethod = (OnPropertyChangedMethod)ClassType.GetMethod("OnPropertyChanged").CreateDelegate(typeof(OnPropertyChangedMethod), EventHandlerClass);
        }
 public override void OnPropertyChanged([CallerMemberName] string?propertyName = null) =>
 OnPropertyChangedMethod?.Invoke(Object, new object[] { propertyName ! });