本文整理汇总了C#中System.CodeDom.CodeExpressionCollection类的典型用法代码示例。如果您正苦于以下问题:C# CodeExpressionCollection类的具体用法?C# CodeExpressionCollection怎么用?C# CodeExpressionCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeExpressionCollection类属于System.CodeDom命名空间,在下文中一共展示了CodeExpressionCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:RuleInvokeAttribute.cs
示例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();
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:RuleInvokeAttribute.cs
示例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);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:RuleReadAttribute.cs
示例4: Constructor1_NullItem
public void Constructor1_NullItem ()
{
CodeExpression[] expressions = new CodeExpression[] {
new CodeExpression (), null };
CodeExpressionCollection coll = new CodeExpressionCollection (
expressions);
}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:CodeExpressionCollectionTest.cs
示例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;
}
开发者ID:jw56578,项目名称:SpecFlowTest,代码行数:8,代码来源:CodeExpressionCollectionExtensions.cs
示例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");
}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:CodeExpressionCollectionTest.cs
示例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);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:References.cs
示例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]);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:CodeExpressionCollection.cs
示例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);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:RuleAnalysis.cs
示例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]);
}
}
开发者ID:geoffkizer,项目名称:corefx,代码行数:13,代码来源:CodeExpressionCollection.cs
示例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);
}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:CodeExpressionCollectionCas.cs
示例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");
}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:CodeExpressionCollectionTest.cs
示例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);
}
}
开发者ID:wskplho,项目名称:Tools,代码行数:14,代码来源:TypeList.cs
示例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);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:BinaryExpression.cs
示例15: CodeObjectCreateExpression
public CodeObjectCreateExpression(Type createType, params CodeExpression[] parameters)
{
this.parameters = new CodeExpressionCollection();
this.CreateType = new CodeTypeReference(createType);
this.Parameters.AddRange(parameters);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:CodeObjectCreateExpression.cs
示例16: OutputExpressionList
protected virtual void OutputExpressionList (CodeExpressionCollection expressions,
bool newLineBetweenItems)
{
++Indent;
IEnumerator enumerator = expressions.GetEnumerator();
if (enumerator.MoveNext()) {
CodeExpression expression = (CodeExpression)enumerator.Current;
GenerateExpression (expression);
while (enumerator.MoveNext()) {
expression = (CodeExpression)enumerator.Current;
output.Write (',');
if (newLineBetweenItems)
output.WriteLine ();
else
output.Write (' ');
GenerateExpression (expression);
}
}
--Indent;
}
开发者ID:carrie901,项目名称:mono,代码行数:24,代码来源:CodeGenerator.cs
示例17: OutputParameters
protected virtual void OutputParameters(CodeExpressionCollection parameters)
{
int count = parameters.Count;
Output.Write("(");
if (count > 0)
{
GenerateExpression(parameters[0]);
for (int i = 1; i < count; ++i)
{
Output.Write(", ");
GenerateExpression(parameters[i]);
}
}
Output.Write(")");
}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:15,代码来源:PABCCodeProvider.cs
示例18: OutputExpressionList
/// <devdoc>
/// <para>
/// Generates code for the specified expression list.
/// </para>
/// </devdoc>
private void OutputExpressionList(CodeExpressionCollection expressions, bool newlineBetweenItems) {
bool first = true;
IEnumerator en = expressions.GetEnumerator();
Indent++;
while (en.MoveNext()) {
if (first) {
first = false;
}
else {
if (newlineBetweenItems)
ContinueOnNewLine(",");
else
Output.Write(", ");
}
((ICodeGenerator)this).GenerateCodeFromExpression((CodeExpression)en.Current, output.InnerWriter, options);
}
Indent--;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:23,代码来源:csharpcodeprovider.cs
示例19: ValidateExpressionList
private void ValidateExpressionList(CodeExpressionCollection expressions) {
IEnumerator en = expressions.GetEnumerator();
while (en.MoveNext()) {
ValidateExpression((CodeExpression)en.Current);
}
}
开发者ID:uQr,项目名称:referencesource,代码行数:6,代码来源:CodeValidator.cs
示例20: AppendInitializers
/// <summary>
/// Appends initializers for an array.
/// </summary>
void AppendInitializers(CodeExpressionCollection initalizers)
{
codeBuilder.Append("(");
codeBuilder.AppendLine();
codeBuilder.IncreaseIndent();
codeBuilder.AppendIndented("[");
bool firstInitializer = true;
foreach (CodeExpression expression in initalizers) {
if (firstInitializer) {
firstInitializer = false;
} else {
codeBuilder.Append(",");
codeBuilder.AppendLine();
codeBuilder.AppendIndented(String.Empty);
}
AppendExpression(expression);
}
codeBuilder.Append("])");
codeBuilder.DecreaseIndent();
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:25,代码来源:RubyCodeDomSerializer.cs
注:本文中的System.CodeDom.CodeExpressionCollection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论