本文整理汇总了C#中IAttribute类的典型用法代码示例。如果您正苦于以下问题:C# IAttribute类的具体用法?C# IAttribute怎么用?C# IAttribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IAttribute类属于命名空间,在下文中一共展示了IAttribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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()));
}
示例6: WriteAttribute
protected virtual void WriteAttribute(IXhtmlWriter writer, IAttribute attribute)
{
if (!attribute.IsDefault || attribute.RendersOnDefaultValue)
{
writer.WriteAttributeString(attribute.Name.ToLowerInvariant(), attribute.SerializedValue);
}
}
示例7: EventInfo
internal EventInfo(Type declaringType, string name, MethodInfo addMethod, MethodInfo removeMethod, IAttribute[] attributes)
{
_declaringType = declaringType;
_name = name;
_addMethod = addMethod;
_removeMethod = removeMethod;
_attributes = attributes;
}
示例8: Modify
public void Modify(IAttribute originalAttribute, IAttribute newAttribute)
{
ICodeExpressionNode node = newAttribute.AddCodeExpressionNode();
string expression = _syntaxProvider.CreateGetPropertyPathExpression(originalAttribute.GetTextValue());
node.SetExpressionBody(
new CodeExpression(expression)
);
}
示例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");
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
示例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));
}
}