ICSharpCode.Core.AddIn.CreateObject C# (CSharp) Method

CreateObject() public method

public CreateObject ( string className ) : object
className string
return object
        public object CreateObject(string className)
        {
            foreach (Runtime runtime in runtimes) {
                object o = runtime.CreateInstance(className);
                if (o != null) {
                    return o;
                }
            }
            if (hasShownErrorMessage) {
                LoggingService.Error("Cannot create object: " + className);
            } else {
                hasShownErrorMessage = true;
                MessageService.ShowError("Cannot create object: " + className + "\nFuture missing objects will not cause an error message.");
            }
            return null;
        }

Usage Example

        public bool IsValid(object parameter, Condition condition)
        {
            IConditionEvaluator evaluator = (IConditionEvaluator)addIn.CreateObject(className);

            if (evaluator == null)
            {
                return(false);
            }
            addIn.AddInTree.ConditionEvaluators[name] = evaluator;
            return(evaluator.IsValid(parameter, condition));
        }
All Usage Examples Of ICSharpCode.Core.AddIn::CreateObject