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

C# IAttribute类代码示例

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

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



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

示例1: pMixinAttributeResolvedResult

 /// <summary>
 /// Creates a new <see cref="pMixinAttributeResolvedResult"/>
 /// </summary>
 /// <param name="attribute">
 /// Reference to the <see cref="CopaceticSoftware.pMixin"/>'s source code.
 /// </param>
 public pMixinAttributeResolvedResult(IAttribute attribute)
     : base(attribute)
 {
     Masks = new List<IType>(0);
     Interceptors = new List<IType>(0);
     EnableSharedRequirementsInterface = new pMixinAttribute().EnableSharedRequirementsInterface;
 }
开发者ID:prescottadam,项目名称:pMixins,代码行数:13,代码来源:pMixinAttributeResolvedResult.cs


示例2: GetTargetModifierList

 private static IAssociations GetTargetModifierList(IAttribute target, string modifierType)
 {
     switch (modifierType)
     {
         case "ModAdd":
             return target.AdditionAssociations;
         case "ModSub":
             return target.SubstractionAssociations;
         case "PostAssignment":
             return target.PostAssignmentAssociations;
         case "PostDiv":
             return target.PostDivisionAssociations;
         case "PostMul":
             return target.PostMultiplicationAssociations;
         case "PostPercent":
             return target.PostPercentAssociations;
         case "PreAssignment":
             return target.PreAssignmentAssociations;
         case "PreDiv":
             return target.PreDivisionAssociations;
         case "PreMul":
             return target.PreMultiplicationAssociations;
         case "9":
             //skilllevel modifier
             return new DummyAssociations();
         default://TODO richtiger exceptiontyp
             throw new Exception("unknown modifier type: " + modifierType);
     }
 }
开发者ID:rischwa,项目名称:eve-fast-fitting-assessment,代码行数:29,代码来源:GetItemModifierExpression.cs


示例3: Resolve

		public IList<IAttribute> Resolve(IAssembly currentAssembly)
		{
			// TODO: make this a per-assembly cache
//				CacheManager cache = currentAssembly.Compilation.CacheManager;
//				IList<IAttribute> result = (IList<IAttribute>)cache.GetShared(this);
//				if (result != null)
//					return result;
			
			ITypeResolveContext context = new SimpleTypeResolveContext(currentAssembly);
			BlobReader reader = new BlobReader(blob, currentAssembly);
			if (reader.ReadByte() != '.') {
				// should not use UnresolvedSecurityDeclaration for XML secdecls
				throw new InvalidOperationException();
			}
			ResolveResult securityActionRR = securityAction.Resolve(context);
			uint attributeCount = reader.ReadCompressedUInt32();
			IAttribute[] attributes = new IAttribute[attributeCount];
			try {
				ReadSecurityBlob(reader, attributes, context, securityActionRR);
			} catch (NotSupportedException) {
				// ignore invalid blobs
				//Debug.WriteLine(ex.ToString());
			}
			for (int i = 0; i < attributes.Length; i++) {
				if (attributes[i] == null)
					attributes[i] = new CecilResolvedAttribute(context, SpecialType.UnknownType);
			}
			return attributes;
//				return (IList<IAttribute>)cache.GetOrAddShared(this, attributes);
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:30,代码来源:UnresolvedSecurityDeclarationBlob.cs


示例4: GetConditionalResourceExpression

 private ConditionalExpression GetConditionalResourceExpression(IAttribute fromAttribute)
 {
     string targetResource = fromAttribute.GetTextValue();
     string nullCheck = _syntaxProvider.CreateNullCheckExpression(targetResource);
     string uriExpression = _syntaxProvider.CreateUriExpression(targetResource);
     return new ConditionalExpression(nullCheck, uriExpression);
 }
开发者ID:drlongnecker,项目名称:openrasta-sparkcodec,代码行数:7,代码来源:CreateUriActionModifier.cs


示例5: Modify

 public void Modify(IAttribute originalAttribute, IAttribute newAttribute)
 {
     ICodeExpressionNode codeExpressionNode = newAttribute.AddCodeExpressionNode();
     codeExpressionNode.SetExpressionBody(new CodeExpression("true"));
     IConditionalExpressionNodeWrapper conditionalExpressionNodeWrapper = newAttribute.AddConditionalExpressionNode();
     conditionalExpressionNodeWrapper.SetExpressionBody(new ConditionalExpression(_syntaxProvider.CreateNullCheckAndEvalExpression(originalAttribute.GetTextValue()), originalAttribute.GetTextValue()));
 }
开发者ID:jennifersmith,项目名称:openrasta-sparkcodec,代码行数:7,代码来源:ValueToConditionalAttribute.cs


示例6: WriteAttribute

 protected virtual void WriteAttribute(IXhtmlWriter writer, IAttribute attribute)
 {
     if (!attribute.IsDefault || attribute.RendersOnDefaultValue)
     {
         writer.WriteAttributeString(attribute.Name.ToLowerInvariant(), attribute.SerializedValue);
     }
 }
开发者ID:endjin,项目名称:openrasta-stable,代码行数:7,代码来源:XhtmlNodeWriter.cs


示例7: EventInfo

 internal EventInfo(Type declaringType, string name, MethodInfo addMethod, MethodInfo removeMethod, IAttribute[] attributes)
 {
     _declaringType = declaringType;
     _name = name;
     _addMethod = addMethod;
     _removeMethod = removeMethod;
     _attributes = attributes;
 }
开发者ID:sebastianhaba,项目名称:api,代码行数:8,代码来源:EventInfo.cs


示例8: Modify

 public void Modify(IAttribute originalAttribute, IAttribute newAttribute)
 {
     ICodeExpressionNode node = newAttribute.AddCodeExpressionNode();
     string expression = _syntaxProvider.CreateGetPropertyPathExpression(originalAttribute.GetTextValue());
     node.SetExpressionBody(
         new CodeExpression(expression)
         );
 }
开发者ID:jennifersmith,项目名称:openrasta-sparkcodec,代码行数:8,代码来源:PropertyPathActionModifier.cs


示例9: AddAssemblyAttribute

		public override void AddAssemblyAttribute(IProject targetProject, IAttribute attribute)
		{
			// FIXME : will fail if there are no assembly attributes
			ICompilation compilation = SD.ParserService.GetCompilation(targetProject);
			IAttribute target = compilation.MainAssembly.AssemblyAttributes.LastOrDefault();
			if (target == null)
				throw new InvalidOperationException("no assembly attributes found, cannot continue!");
			AddAttribute(target.Region, attribute, "assembly");
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:9,代码来源:CSharpCodeGenerator.cs


示例10: TryAttribute

 public bool TryAttribute(string name, out IAttribute attr) {
     if (Attributes.Any()) {
         if (Attributes.Exists(a => a.Name == name)) {
             attr = Attributes.First(a => a.Name == name);
             return true;
         }
     }
     attr = null;
     return false;
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:10,代码来源:XDocumentNode.cs


示例11: CreateValue

        public IAttributeValue CreateValue(IAttribute attribute, String value)
        {
            //            checkArgument(value != null, "Value cannot be null.");
            throw new NotImplementedException();
            //AttributeValue rv = new AttributeValue(attribute);
            //rv.setValue(value);
            //_List.Add(rv);

            //return rv;
        }
开发者ID:Vanaheimr,项目名称:Walkyr,代码行数:10,代码来源:AttributeValueList.cs


示例12: IsRefined

 public static bool IsRefined(this IClass @class, IAttribute attribute)
 {
     var refine = @class.AttributeConstraints.Any(c => c.Constrains == attribute) || @class.Attributes.Any(r => r.Refines == attribute);
     if (refine) return true;
     foreach (var baseType in @class.BaseTypes)
     {
         if (baseType == attribute.DeclaringType) return false;
         if (IsRefined(baseType, attribute)) return true;
     }
     return false;
 }
开发者ID:NMFCode,项目名称:NMF,代码行数:11,代码来源:ClassExtensions.cs


示例13: CreateAttribute

		public void CreateAttribute(string fullName, string shortName)
		{
			var returnTypeHelper = new ReturnTypeHelper();
			returnTypeHelper.CreateReturnType(fullName);
			returnTypeHelper.AddShortName(shortName);
			AttributeType = returnTypeHelper.ReturnType;
			
			Attribute = MockRepository.GenerateStub<IAttribute>();
			Attribute.Stub(a => a.AttributeType).Return(AttributeType);
			Attribute.Stub(a => a.PositionalArguments).Return(PositionalArguments);
			Attribute.Stub(a => a.NamedArguments).Return(NamedArguments);
		}
开发者ID:GMRyujin,项目名称:SharpDevelop,代码行数:12,代码来源:AttributeHelper.cs


示例14: ToString

 public static string ToString(IAttribute attribute)
 {
     var builder = new StringBuilder();
     var attributeType = attribute.GetType();
     builder.Append("  - ").Append(attributeType.Name).AppendLine();
     foreach (var eachProperty in attributeType.GetProperties())
     {
         var propertyValue = eachProperty.GetValue(attribute);
         builder.Append("    - ").Append(eachProperty.Name).Append('=').Append(propertyValue).AppendLine();
     }
     return builder.ToString();
 }
开发者ID:ktj007,项目名称:mmo,代码行数:12,代码来源:AttributeHelper.cs


示例15: Assign

        public static void Assign(this IAttribute attribute, IAttribute other)
        {
            Debug.Assert(attribute != null);
            if (other == null)
                return;

            Debug.Assert(attribute.GetType() == other.GetType());
            foreach (var eachProperty in attribute.GetType().GetProperties())
            {
                eachProperty.SetValue(attribute, eachProperty.GetValue(other));
            }
        }
开发者ID:ktj007,项目名称:mmo,代码行数:12,代码来源:AttributeExtension.cs


示例16: ApplyMinConstraints

        private static object ApplyMinConstraints(ConstraintsAttribute constraints, object newValue, IAttribute attribute, PropertyInfo propertyInfo)
        {
            switch (constraints.ValueType)
            {
                case ConstraintsValueType.IntValue:
                    return Math.Max(newValue.As<int>(), constraints.IntValue);

                case ConstraintsValueType.FloatValue:
                    return Math.Max(newValue.As<float>(), constraints.FloatValue);

                case ConstraintsValueType.Reference:
                    return Math.Max(newValue.As<float>(), propertyInfo.GetValue(attribute).As<float>());
            }
            throw new InvalidOperationException("invalid value-type for max constraints: " + constraints.ValueType);
        }
开发者ID:ktj007,项目名称:mmo,代码行数:15,代码来源:ConstraintsHelper.cs


示例17: GetCustomAttribute

        public static IAttribute GetCustomAttribute(IAttribute attribute, INode parent, IQualifiedName name, string value)
        {
            var attributeName = attribute.Name.ToString();

            if (!customAttributeFactories.ContainsKey(attributeName))
                return null;

            foreach (var factory in customAttributeFactories[attributeName])
            {
                if (factory.IsValidFor(attribute))
                    return factory.Create(parent, name, value);
            }

            return null;
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:15,代码来源:XmlNodeExtensions.cs


示例18: CompareTo

        public virtual int CompareTo(IAttribute value)
        {
            int cmp;

            cmp = Name.CompareTo(value.Name);
            if (cmp != 0) {
                return cmp;
            }

            cmp = DiffUtility.Compare(PositionalArguments, value.PositionalArguments);
            if (cmp != 0) {
                return cmp;
            }

            return DiffUtility.Compare(NamedArguments, value.NamedArguments);
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:16,代码来源:AbstractAttribute.cs


示例19: GetAttributeConstraintValue

 public static ICollection<string> GetAttributeConstraintValue(this IClass referenceClass, IAttribute attribute)
 {
     var attRefinement = referenceClass.AttributeConstraints.FirstOrDefault(c => c.Constrains == attribute);
     if (attRefinement != null)
     {
         return attRefinement.Values;
     }
     foreach (var baseClass in referenceClass.BaseTypes)
     {
         var value = baseClass.GetAttributeConstraintValue(attribute);
         if (value != null)
         {
             return value;
         }
     }
     return null;
 }
开发者ID:NMFCode,项目名称:NMF,代码行数:17,代码来源:ModelExtensions.cs


示例20: IsAvailable

 public bool IsAvailable(IUserDataHolder cache)
 {
     _propertyAssignment = null;
     _dllImportAttribute = null;
     Func<IAttribute, bool> isDllImportAttribute = a =>
     {
         var typeReference = a.TypeReference;
         if (typeReference != null)
         {
             var typeElement = typeReference.Resolve().DeclaredElement as ITypeElement;
             if (typeElement != null && Equals(typeElement.GetClrName(), DllImportMissingAnalyzer.DllImportAttribute))
             {
                 return true;
             }
         }
         return false;
     };
     var method = _provider.GetSelectedElement<IMethodDeclaration>(true, true);
     if (method == null)
     {
         return false;
     }
     var attribute = method.Attributes.FirstOrDefault(isDllImportAttribute);
     if (attribute == null || !attribute.IsValid())
     {
         return false;
     }
     _dllImportAttribute = attribute;
     var entryPoint = attribute.PropertyAssignments.FirstOrDefault(pa => pa.PropertyNameIdentifier.Name == "EntryPoint");
     if (entryPoint == null)
     {
         return true;
     }
     _propertyAssignment = entryPoint;
     var literal = entryPoint.Source as ICSharpLiteralExpression;
     if (literal != null)
     {
         if (!literal.IsConstantValue())
         {
             return true;
         }
         var value = literal.ConstantValue.Value as string;
         return value != method.NameIdentifier.Name;
     }
     return false;
 }
开发者ID:vcsjones,项目名称:ResharperInteropHelpers,代码行数:46,代码来源:DllImportAddExplicitEntryPoint.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IAttributeDefinition类代码示例发布时间:2022-05-24
下一篇:
C# IAtomContainer类代码示例发布时间: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