当前位置: 首页>>代码示例>>C#>>正文


C# IParameter类代码示例

本文整理汇总了C#中IParameter的典型用法代码示例。如果您正苦于以下问题:C# IParameter类的具体用法?C# IParameter怎么用?C# IParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IParameter类属于命名空间,在下文中一共展示了IParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WithParameter

        public PendingBinaryStateOutputActuatorState WithParameter(IParameter parameter)
        {
            if (parameter == null) throw new ArgumentNullException(nameof(parameter));

            Parameters.Add(parameter);
            return this;
        }
开发者ID:rishabhbanga,项目名称:CK.HomeAutomation,代码行数:7,代码来源:PendingBinaryStateOutputActuatorState.cs

示例2: GetParameterTypeReference

        internal static CodeTypeReference GetParameterTypeReference(CodeTypeDeclaration classDeclaration,
            IParameter param)
        {
            Type underlyingType = GetParameterType(param);
            CodeTypeReference paramTypeRef = new CodeTypeReference(underlyingType);
            bool isValueType = underlyingType.IsValueType;

            // Check if we need to declare a custom type for this parameter.
            // If the parameter is an enum, try finding the matching enumeration in the current class
            if (!param.EnumValues.IsNullOrEmpty())
            {
                // Naming scheme: MethodnameParametername
                CodeTypeReference enumReference = DecoratorUtil.FindFittingEnumeration(
                    classDeclaration, param.EnumValues, param.EnumValueDescriptions);

                if (enumReference != null)
                {
                    paramTypeRef = enumReference;
                    isValueType = true;
                }
            }

            // Check if this is an optional value parameter.
            if (isValueType && !param.IsRequired)
            {
                paramTypeRef = new CodeTypeReference(typeof(Nullable<>))
                {
                    TypeArguments = { paramTypeRef.BaseType }
                };
                // An optional value parameter has to be nullable.
            }

            return paramTypeRef;
        }
开发者ID:artzub,项目名称:LoggenCSG,代码行数:34,代码来源:ResourceBaseGenerator.cs

示例3: ProcessParameter

 private void ProcessParameter(IParameter parameter, int index, StringBuilder preMemberCodeBulider)
 {
     // Dispatch to the typed parameter handler method.
     Type key = parameter.GetType().GetInterfaces().First(t => t.Namespace == typeof(IParameter).Namespace && t.Name.StartsWith("I") && t.Name.EndsWith("Parameter"));
     Action<IParameter, int, StringBuilder> method = _parameterCodeGeneratorMethodMap[key];
     method(parameter, index, preMemberCodeBulider);
 }
开发者ID:wade,项目名称:Speedioc,代码行数:7,代码来源:ParameterInjectionCodeGenerator.cs

示例4: ConstructorInjectionComponentAdapter

 public ConstructorInjectionComponentAdapter(object componentKey, Type componentImplementation,
                                             IParameter[] parameters, bool allowNonPublicClasses,
                                             IComponentMonitor componentMonitor)
     : base(componentKey, componentImplementation, parameters, allowNonPublicClasses)
 {
     this.componentMonitor = componentMonitor;
 }
开发者ID:smmckay,项目名称:picocontainer,代码行数:7,代码来源:ConstructorInjectionComponentAdapter.cs

示例5: ParameterCollection

 public ParameterCollection(IParameter[] parameters)
 {
     foreach (IParameter parameter in parameters)
     {
         AddParameter(parameter);
     }
 }
开发者ID:joshuaflanagan,项目名称:structuremap,代码行数:7,代码来源:ParameterCollection.cs

示例6: CreateComponentAdapter

 public IComponentAdapter CreateComponentAdapter(object componentKey, Type componentImplementation,
                                                 IParameter[] parameters)
 {
     return
         new CachingComponentAdapter(
             new ConstructorInjectionComponentAdapter(componentKey, componentImplementation, parameters));
 }
开发者ID:smmckay,项目名称:picocontainer,代码行数:7,代码来源:DefaultComponentAdapterFactory.cs

示例7: CreatePresenterInstance

        protected override IPresenter CreatePresenterInstance(Type presenterType, TypedPageData pageData, Type viewType, IEPiView view)
        {
            // Unfortunately, Ninject needs the bloody names of the parameters,
            // so we need to figure them out by reflecting.
            string pageDataParameterName = null;
            string viewParameterName = null;
            foreach (var constructor in presenterType.GetConstructors())
            {
                var constructorParameters = constructor.GetParameters();
                foreach (var parameter in constructorParameters)
                {
                    if (parameter.ParameterType.IsAssignableFrom(pageData.GetType()))
                        pageDataParameterName = parameter.Name;

                    if (parameter.ParameterType.IsAssignableFrom(view.GetType()))
                        viewParameterName = parameter.Name;
                }
            }
            var parameters = new IParameter[]
                                 {
                                     new ConstructorArgument(viewParameterName, view),
                                     new ConstructorArgument(pageDataParameterName, pageData)
                                 };
            return (IPresenter)Kernel.Get(presenterType, parameters);
        }
开发者ID:MikeHook,项目名称:EPiServer-MVP,代码行数:25,代码来源:NinjectPresenterFactory.cs

示例8: Resolve

        public object[] Resolve(object requestParameters, IParameter[] targetParameters)
        {
            // Convert to array
            var parameters = ((IEnumerable) requestParameters).Cast<object>().ToArray();

            // If length does not match, throw.
            if (parameters.Length != targetParameters.Length)
            {
                throw new ParameterLengthMismatchException();
            }

            var result = new List<object>();

            // Loop through and parse parameters
            for (var i = 0; i < parameters.Length; i++)
            {
                var request = parameters[i];
                var target = targetParameters[i];

                // If the target parameter is `object`, do not try to convert it.
                if (target.ParameterType == typeof (object))
                {
                    result.Add(request);
                }
                else
                {
                    var serialized = _serializer.SerializeObject(request);
                    var converted = _serializer.DeserializeObject(serialized, target.ParameterType);

                    result.Add(converted);
                }
            }

            return result.ToArray();
        }
开发者ID:DNIDNL,项目名称:hadouken,代码行数:35,代码来源:ByPositionResolver.cs

示例9: btnOK_Click

 private void btnOK_Click(object sender, EventArgs e)
 {
     this.NewParameter = this.cboxNewName.SelectedItem as IParameter;
     this.OldParameter = this.cboxOldName.SelectedItem as IParameter;
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
开发者ID:K-Library-NET,项目名称:PopcornStudios,代码行数:7,代码来源:frmReplaceCurve.cs

示例10: WrapComponentInstances

        protected virtual IPicoContainer WrapComponentInstances(Type decoratingComponentAdapterClass,
                                                                IPicoContainer picoContainer,
                                                                object[] wrapperDependencies)
        {
            Assert.IsTrue(typeof (DecoratingComponentAdapter).IsAssignableFrom(decoratingComponentAdapterClass));
            IMutablePicoContainer mutablePicoContainer = new DefaultPicoContainer();
            int size = (wrapperDependencies != null ? wrapperDependencies.Length : 0) + 1;
            ICollection allComponentAdapters = picoContainer.ComponentAdapters;

            foreach (object adapter in allComponentAdapters)
            {
                IParameter[] parameters = new IParameter[size];
                parameters[0] = new ConstantParameter(adapter);
                for (int i = 1; i < parameters.Length; i++)
                {
                    parameters[i] = new ConstantParameter(wrapperDependencies[i - 1]);
                }
                IMutablePicoContainer instantiatingPicoContainer =
                    new DefaultPicoContainer(new ConstructorInjectionComponentAdapterFactory());
                instantiatingPicoContainer.RegisterComponentImplementation("decorator", decoratingComponentAdapterClass,
                                                                           parameters);
                mutablePicoContainer.RegisterComponent(
                    (IComponentAdapter) instantiatingPicoContainer.GetComponentInstance("decorator"));
            }
            return mutablePicoContainer;
        }
开发者ID:smmckay,项目名称:picocontainer,代码行数:26,代码来源:AbstractComponentAdapterTestCase.cs

示例11: DefaultParameter

		public DefaultParameter(IParameter p)
		{
			this.name = p.Name;
			this.region = p.Region;
			this.modifier = p.Modifiers;
			this.returnType = p.ReturnType;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:DefaultParameter.cs

示例12: InstantiatingComponentAdapter

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="componentKey">The component's key</param>
 /// <param name="componentImplementation">The component implementing type</param>
 /// <param name="parameters">Parameters used to initialize the component</param>
 /// <param name="allowNonPublicClasses">flag to allow instantiation of non-public classes.</param>
 public InstantiatingComponentAdapter(object componentKey, Type componentImplementation, IParameter[] parameters,
                                      bool allowNonPublicClasses)
     : base(componentKey, componentImplementation)
 {
     this.parameters = parameters;
     this.allowNonPublicClasses = allowNonPublicClasses;
 }
开发者ID:smmckay,项目名称:picocontainer,代码行数:14,代码来源:InstantiatingComponentAdapter.cs

示例13: ParseParameterValue

        public override bool ParseParameterValue(IParameter parameter, string parameterValue)
        {
            bool returnValue = base.ParseParameterValue(parameter, parameterValue);

            if (returnValue)
            {
                switch (parameter.Name)
                {
                    case _ParameterAlternateNameSource:
                    case _ParameterNameSource:
                        parameterValue = parameterValue.Trim();
                        if (Directory.Exists(parameterValue))
                        {
                            ((Parameter<string>)parameter).Value = parameterValue;
                        }
                        else
                        {
                            returnValue = false;
                        }
                        break;
                }
            }

            return returnValue;
        }
开发者ID:vpalivela,项目名称:I18NUtility,代码行数:25,代码来源:ExportResxCommand.cs

示例14: ValidateParameter

        /// <summary>
        /// Validates a parameter.
        /// 
        /// Checks to see if it is required, or if it needs regex validation.
        /// </summary>
        /// <param name="param">
        /// A <see cref="IParameter"/>
        /// </param>
        /// <returns>
        /// A <see cref="System.Boolean"/>
        /// </returns>
        public bool ValidateParameter(IParameter param)
        {
            if (Parameters == null)
            {
                return false;
            }

            string currentParam;
            bool parameterPresent = Parameters.TryGetValue(param.Name, out currentParam);

            // If a required parameter is not present, fail.
            if (String.IsNullOrEmpty(currentParam) || !parameterPresent)
            {
                return !param.IsRequired;
            }
        
            // The parameter is present, validate the regex.
            bool isValidData = ValidateRegex(param, currentParam) && ValidateEnum(param, currentParam);
            if (isValidData == false)
            {
                return false;
            }

            return true;
        }
开发者ID:jithuin,项目名称:infogeezer,代码行数:36,代码来源:MethodValidator.cs

示例15: AddParameter

        public void AddParameter(IParameter parameter)
        {
            if (parameter == null)
                throw new ArgumentNullException("parameter");

            parameters.Add(parameter.Name, parameter.Value);
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:ComplexCommandBuilder.cs


注:本文中的IParameter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。