本文整理汇总了C#中System.CodeDom.CodeExpressionCollection类的典型用法代码示例。如果您正苦于以下问题:C# CodeExpressionCollection类的具体用法?C# CodeExpressionCollection怎么用?C# CodeExpressionCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CodeExpressionCollection类属于System.CodeDom命名空间,在下文中一共展示了CodeExpressionCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Analyze
internal override void Analyze(RuleAnalysis analysis, MemberInfo member, CodeExpression targetExpression, RulePathQualifier targetQualifier, CodeExpressionCollection argumentExpressions, ParameterInfo[] parameters, List<CodeExpression> attributedExpressions)
{
Stack<MemberInfo> methodStack = new Stack<MemberInfo>();
methodStack.Push(member);
this.AnalyzeInvokeAttribute(analysis, member.DeclaringType, methodStack, targetExpression, targetQualifier, argumentExpressions, parameters, attributedExpressions);
methodStack.Pop();
}
示例2: AnalyzeInvokeAttribute
private void AnalyzeInvokeAttribute(RuleAnalysis analysis, Type contextType, Stack<MemberInfo> methodStack, CodeExpression targetExpression, RulePathQualifier targetQualifier, CodeExpressionCollection argumentExpressions, ParameterInfo[] parameters, List<CodeExpression> attributedExpressions)
{
foreach (MemberInfo info in contextType.GetMember(this.methodInvoked, MemberTypes.Property | MemberTypes.Method, BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance))
{
if (!methodStack.Contains(info))
{
methodStack.Push(info);
object[] customAttributes = info.GetCustomAttributes(typeof(RuleAttribute), true);
if ((customAttributes != null) && (customAttributes.Length != 0))
{
foreach (RuleAttribute attribute in (RuleAttribute[]) customAttributes)
{
RuleReadWriteAttribute attribute2 = attribute as RuleReadWriteAttribute;
if (attribute2 != null)
{
attribute2.Analyze(analysis, info, targetExpression, targetQualifier, argumentExpressions, parameters, attributedExpressions);
}
else
{
((RuleInvokeAttribute) attribute).AnalyzeInvokeAttribute(analysis, contextType, methodStack, targetExpression, targetQualifier, argumentExpressions, parameters, attributedExpressions);
}
}
}
methodStack.Pop();
}
}
}
示例3: Analyze
internal override void Analyze(RuleAnalysis analysis, MemberInfo member, CodeExpression targetExpression, RulePathQualifier targetQualifier, CodeExpressionCollection argumentExpressions, ParameterInfo[] parameters, List<CodeExpression> attributedExpressions)
{
if (!analysis.ForWrites)
{
base.AnalyzeReadWrite(analysis, targetExpression, targetQualifier, argumentExpressions, parameters, attributedExpressions);
}
}
示例4: Constructor1_NullItem
public void Constructor1_NullItem ()
{
CodeExpression[] expressions = new CodeExpression[] {
new CodeExpression (), null };
CodeExpressionCollection coll = new CodeExpressionCollection (
expressions);
}
示例5: Clone
public static CodeExpressionCollection Clone(this CodeExpressionCollection collection)
{
if (collection == null) return null;
CodeExpressionCollection c = new CodeExpressionCollection();
foreach (CodeExpression expression in collection)
c.Add(expression.Clone());
return c;
}
示例6: Constructor0
public void Constructor0 ()
{
CodeExpressionCollection coll = new CodeExpressionCollection ();
Assert.IsFalse (((IList) coll).IsFixedSize, "#1");
Assert.IsFalse (((IList) coll).IsReadOnly, "#2");
Assert.AreEqual (0, coll.Count, "#3");
Assert.IsFalse (((ICollection) coll).IsSynchronized, "#4");
}
示例7: AnalyzeRuleAttributes
internal void AnalyzeRuleAttributes(MemberInfo member, CodeExpression targetExpr, RulePathQualifier targetQualifier, CodeExpressionCollection argExprs, ParameterInfo[] parameters, List<CodeExpression> attributedExprs)
{
object[] attrs = member.GetCustomAttributes(typeof(RuleAttribute), true);
if (attrs != null && attrs.Length > 0)
{
RuleAttribute[] ruleAttrs = (RuleAttribute[])attrs;
for (int i = 0; i < ruleAttrs.Length; ++i)
ruleAttrs[i].Analyze(this, member, targetExpr, targetQualifier, argExprs, parameters, attributedExprs);
}
}
示例8: AddRange
public void AddRange(CodeExpressionCollection value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
int count = value.Count;
for (int i = 0; i < count; i++)
{
this.Add(value[i]);
}
}
示例9: AnalyzeRuleAttributes
internal void AnalyzeRuleAttributes(MemberInfo member, CodeExpression targetExpr, RulePathQualifier targetQualifier, CodeExpressionCollection argExprs, ParameterInfo[] parameters, List<CodeExpression> attributedExprs)
{
object[] customAttributes = member.GetCustomAttributes(typeof(RuleAttribute), true);
if ((customAttributes != null) && (customAttributes.Length > 0))
{
RuleAttribute[] attributeArray = (RuleAttribute[]) customAttributes;
for (int i = 0; i < attributeArray.Length; i++)
{
attributeArray[i].Analyze(this, member, targetExpr, targetQualifier, argExprs, parameters, attributedExprs);
}
}
}
示例10: AddRange
public void AddRange(CodeExpressionCollection value)
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
int currentCount = value.Count;
for (int i = 0; i < currentCount; i++)
{
Add(value[i]);
}
}
示例11: Constructor1_Deny_Unrestricted
public void Constructor1_Deny_Unrestricted ()
{
CodeExpressionCollection coll = new CodeExpressionCollection (array);
coll.CopyTo (array, 0);
Assert.AreEqual (1, coll.Add (ce), "Add");
Assert.AreSame (ce, coll[0], "this[int]");
coll.AddRange (array);
coll.AddRange (coll);
Assert.IsTrue (coll.Contains (ce), "Contains");
Assert.AreEqual (0, coll.IndexOf (ce), "IndexOf");
coll.Insert (0, ce);
coll.Remove (ce);
}
示例12: Constructor1
public void Constructor1 ()
{
CodeExpression exp1 = new CodeExpression ();
CodeExpression exp2 = new CodeExpression ();
CodeExpression[] expressions = new CodeExpression[] { exp1, exp2 };
CodeExpressionCollection coll = new CodeExpressionCollection (
expressions);
Assert.AreEqual (2, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (exp1), "#2");
Assert.AreEqual (1, coll.IndexOf (exp2), "#3");
}
示例13: AddTypes
private static void AddTypes(string prepend, bool nested, CodeTypeDeclarationCollection types, CodeExpressionCollection into)
{
foreach (CodeTypeDeclaration t in types) {
into.Add(new CodeTypeOfExpression(
((prepend == null || prepend == "") ? "" : (prepend + (nested ? "+" : "."))) + t.Name));
CodeTypeDeclarationCollection ctd = new CodeTypeDeclarationCollection();
foreach (CodeTypeMember m in t.Members) {
if (m is CodeTypeDeclaration) ctd.Add((CodeTypeDeclaration)m);
}
AddTypes(
((prepend == null || prepend == "") ? "" : (prepend + (nested ? "+" : "."))) + t.Name,
true, ctd, into);
}
}
示例14: AnalyzeUsage
internal override void AnalyzeUsage(CodeExpression expression, RuleAnalysis analysis, bool isRead, bool isWritten, RulePathQualifier qualifier)
{
CodeBinaryOperatorExpression expression2 = (CodeBinaryOperatorExpression) expression;
RuleBinaryExpressionInfo info = analysis.Validation.ExpressionInfo(expression2) as RuleBinaryExpressionInfo;
if (info != null)
{
MethodInfo methodInfo = info.MethodInfo;
if (methodInfo != null)
{
List<CodeExpression> attributedExprs = new List<CodeExpression>();
CodeExpressionCollection argExprs = new CodeExpressionCollection();
argExprs.Add(expression2.Left);
argExprs.Add(expression2.Right);
CodeExpression targetExpr = new CodeTypeReferenceExpression(methodInfo.DeclaringType);
analysis.AnalyzeRuleAttributes(methodInfo, targetExpr, qualifier, argExprs, methodInfo.GetParameters(), attributedExprs);
}
}
RuleExpressionWalker.AnalyzeUsage(analysis, expression2.Left, true, false, null);
RuleExpressionWalker.AnalyzeUsage(analysis, expression2.Right, true, false, null);
}
示例15: CodeObjectCreateExpression
public CodeObjectCreateExpression(Type createType, params CodeExpression[] parameters)
{
this.parameters = new CodeExpressionCollection();
this.CreateType = new CodeTypeReference(createType);
this.Parameters.AddRange(parameters);
}