• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IParameter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: CreateSubmission

        public int CreateSubmission(Dictionary<string, string> dataDictionary)
        {
            IParameter[] parameters = new IParameter[2];
            parameters[0] = FormStorageCore.SqlHelper.CreateParameter("@DBformID", DBformID);
            parameters[1] = FormStorageCore.SqlHelper.CreateParameter("@ipAddress", FormStorageCore.GetUserIP());

            //create submission
            int submissionID = FormStorageCore.SqlHelper.ExecuteScalar<int>("INSERT INTO FormStorageSubmissions (formID, IP, datetime) VALUES (@DBformID, @ipAddress, GETDATE());SELECT SCOPE_IDENTITY() AS submissionID;", parameters);
            //HttpContext.Current.Response.Write("Submission ID=>" + submissionID + "<br/>");

            if (submissionID == 0)
            {
                throw new Exception("Could not create a record in table FormStorageSubmissions.");
            }

            parameters = new IParameter[3];
            parameters[0] = FormStorageCore.SqlHelper.CreateParameter("@submissionID", submissionID);

            foreach (string formField in formFields)
            {
                try
                {
                    parameters[1] = FormStorageCore.SqlHelper.CreateParameter("@fieldAlias", formField);
                    parameters[2] = FormStorageCore.SqlHelper.CreateParameter("@value", HttpUtility.HtmlEncode(dataDictionary[formField]));
                    int entryID = FormStorageCore.SqlHelper.ExecuteScalar<int>("INSERT INTO FormStorageEntries (submissionID, fieldAlias, value) VALUES (@submissionID, @fieldAlias, @value);SELECT SCOPE_IDENTITY() AS entryID;", parameters);
                }
                catch (Exception e2)
                {
                    //HttpContext.Current.Response.Write(e2.Message);
                }
            }

            return submissionID;
        }
开发者ID:biapar,项目名称:FormStorage,代码行数:34,代码来源:FormSchema.cs


示例17: GenerateParameterProperty

        internal CodeTypeMemberCollection GenerateParameterProperty(IParameter parameter,
            IMethod method,
            CodeTypeDeclaration resourceClass,
            IEnumerable<string> usedNames)
        {
            // Get the name and return type of this parameter.
            string name = parameter.Name;
            CodeTypeReference returnType = ResourceBaseGenerator.GetParameterTypeReference(
                resourceClass, parameter);

            // Generate the property and field.
            CodeTypeMemberCollection newMembers = DecoratorUtil.CreateAutoProperty(
                name, parameter.Description, returnType, usedNames, parameter.IsRequired);

            // Add the KeyAttribute to the property.
            foreach (CodeTypeMember member in newMembers)
            {
                CodeMemberProperty property = member as CodeMemberProperty;
                if (property == null)
                {
                    continue;
                }

                // Declare the RequestParameter attribute.
                CodeTypeReference attributeType = new CodeTypeReference(typeof(RequestParameterAttribute));
                CodeAttributeDeclaration attribute = new CodeAttributeDeclaration(attributeType);
                attribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(parameter.Name)));
                property.CustomAttributes.Add(attribute);
            }

            return newMembers;
        }
开发者ID:nick0816,项目名称:LoggenCSG,代码行数:32,代码来源:ParameterPropertyDecorator.cs


示例18: CreateComponentAdapter

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


示例19: ValueOrderSignature

        public ValueOrderSignature(
            string syntax,
            string description,
            ITrackingSpan trackingSpan,
            ISignatureHelpSession session)
        {

            _propertyName = "Syntax";
            _syntax = syntax ?? string.Empty;
            _description = description;
            _trackingSpan = trackingSpan;

            _content = string.Format(CultureInfo.InvariantCulture, "{0}: {1}", _propertyName, _syntax);
            _nameParam = new CssPropertyNameParameter(this);
            _currentParam = _nameParam;

            _session = session;

            // In order to dismiss this tip at the appropriate time, I need to listen
            // to changes in the text buffer
            if (_trackingSpan != null && _session != null)
            {
                _session.Dismissed += OnSessionDismissed;
                _trackingSpan.TextBuffer.Changed += OnTextBufferChanged;
            }
        }
开发者ID:EdsonF,项目名称:WebEssentials2013,代码行数:26,代码来源:ValueOrderSignature.cs


示例20: AddToDate

        public AddToDate(IElementCreationContext context) 
            : base(context, context.Owner.GetVplTypeOrThrow(VplTypeId.DateTime))
        {
            DateParameter = context.Owner.CreateParameter("date", context.Owner.GetVplTypeOrThrow(VplTypeId.DateTime),
                "Date");

            DateParameter.Postfix = " + ";

            AmountParameter = context.Owner.CreateParameter("amount", context.Owner.GetFloatType());

            Parameters.Add(DateParameter);
            Parameters.Add(AmountParameter);

            _services = new OperationService[]
            {
                new OperationService(OperationType.Seconds, "Seconds", TimeSpan.FromSeconds),
                new OperationService(OperationType.Minutes, "Minutes", TimeSpan.FromMinutes),
                new OperationService(OperationType.Hours, "Hours", TimeSpan.FromHours),
                new OperationService(OperationType.Days, "Days", TimeSpan.FromDays),
            };

            Operation = OperationType.Seconds;

            if (!string.IsNullOrWhiteSpace(context.Data))
            {
                var data = JsonConvert.DeserializeObject<OperatorData>(context.Data);

                Operation = data.Operation;
            }

            foreach (var service in _services)
            {
                AddAction(new ElementAction(service.Text, () => Operation = service.Operation, () => Operation != service.Operation));
            }
        }
开发者ID:CaptiveAire,项目名称:VPL,代码行数:35,代码来源:AddToDate.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IParameterCollection类代码示例发布时间:2022-05-24
下一篇:
C# IPalette类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap