当前位置: 首页>>代码示例>>C#>>正文


C# ClassInfo类代码示例

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


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

示例1: Analyze

        public AnalysisResult Analyze(CommonSyntaxTree tree, SemanticModel model, ClassInfo classInfo)
        {
            //TODO: Refactor this whole method later and make it more robust

            if (classInfo.GuardedFields.Count <= 1)
            {
                return AnalysisResult.Succeeded;
            }

            foreach (GuardedFieldInfo first in classInfo.GuardedFields)
            {
                foreach (GuardedFieldInfo second in classInfo.GuardedFields)
                {
                    if (first == second)
                    {
                        continue;
                    }

                    if (LockHierarchy.Conflicts(first.DeclaredLockHierarchy, second.DeclaredLockHierarchy))
                    {
                        return new AnalysisResult(new Issue(
                            ErrorCode.GUARDED_FIELD_LOCK_HIERARCHY_DECLARATION_CONFLICT,
                            second.Declaration,
                            second.Symbol));
                    }
                }
            }

            return AnalysisResult.Succeeded;
        }
开发者ID:flashcurd,项目名称:ThreadSafetyAnnotations,代码行数:30,代码来源:GuardedFieldLockHierarchyDeclarationMustNotConflict.cs

示例2: GetFieldRunnable

 public GetFieldRunnable(IClassRepository repository, ClassInfo classInfo, Instruction instruction, BlockDecomposer block)
 {
     this.repository = repository;
     this.classInfo = classInfo;
     this.instruction = instruction;
     this.block = block;
 }
开发者ID:dbremner,项目名称:dotnet-testability-explorer,代码行数:7,代码来源:GetFieldRunnable.cs

示例3: AddClass

 public void AddClass(ClassInfo classInfo)
 {
     _rapidAccessForClassesByName.Add(classInfo.UnderlyingType, classInfo);
     _existingClasses.Add(classInfo.UnderlyingType);
     _rapidAccessForClassesByOid.Add(classInfo.ClassInfoId, classInfo);
     _allClassInfos.Add(classInfo);
 }
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:7,代码来源:MetaModel.cs

示例4: AddClass

 public void AddClass(ClassInfo classInfo)
 {
     if (!classes.Contains(classInfo.Name))
     {
         classes.Add(classInfo.Name, classInfo);
     }
 }
开发者ID:dbremner,项目名称:dotnet-testability-explorer,代码行数:7,代码来源:ClrClassRepository.cs

示例5: GetClassInfo

        public ClassInfo GetClassInfo(ClassDeclarationSyntax classDeclaration)
        {
            _walker.Visit(classDeclaration);

            ClassInfo classInfo = new ClassInfo(classDeclaration, _semanticModel, _semanticModel.GetDeclaredSymbol(classDeclaration));

            classInfo.Locks.AddRange(_walker.Locks);
            classInfo.GuardedFields.AddRange(_walker.GuardedFields);
            classInfo.Members.AddRange(_walker.Members);

            foreach (LockInfo lockInfo in classInfo.Locks)
            {
                lockInfo.Parent = classInfo;
            }

            foreach (GuardedFieldInfo fieldInfo in classInfo.GuardedFields)
            {
                fieldInfo.Parent = classInfo;
            }

            foreach (MemberInfo memberInfo in classInfo.Members)
            {
                memberInfo.Parent = classInfo;
            }

            return classInfo;
        }
开发者ID:flashcurd,项目名称:ThreadSafetyAnnotations,代码行数:27,代码来源:ClassInspector.cs

示例6: TryGetClass

 private bool TryGetClass(ModuleDefinition module, string className, out ClassInfo clazz)
 {
     var visitor = new ModuleInfoVisitor(this, className);
     module.Accept(visitor);
     clazz = visitor.GetClassInfo();
     return clazz != null;
 }
开发者ID:dbremner,项目名称:dotnet-testability-explorer,代码行数:7,代码来源:ClrClassRepository.cs

示例7: FieldVisitor

        //public FieldVisitor(ClassInfo classInfo, string name, string descriptor, string signature, object value, 
        //    bool isFinal, bool isStatic, bool isPrivate)
        //{
        //    Type type = ClrType.FromDescriptor(descriptor);

        //    classInfo.AddField(new FieldInfo(classInfo, name, type, isFinal, isStatic, isPrivate));
        //}

        public FieldVisitor(ClassInfo classInfo, FieldDefinition fieldDefinition)
        {
            //classInfo.AddField();
            //Type type = ClrType.FromName(fieldDefinition.FieldType.FullName);
            Type type = ClrType.FromDescriptor(fieldDefinition.FieldType.FullName);
            classInfo.AddField(new FieldInfo(classInfo, fieldDefinition.Name, type, false, fieldDefinition.IsStatic, fieldDefinition.IsPrivate));
        }
开发者ID:dbremner,项目名称:dotnet-testability-explorer,代码行数:15,代码来源:FieldVisitor.cs

示例8: Fill

        public IList<TeacherClass> Fill(ClassInfo classInfo)
        {
            if (classInfo == null)
            {
                return null;
            }

            IList<Core.Business.TeacherClass> teacherClasslist = new List<Core.Business.TeacherClass>();

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@ClassCode", SqlDbType.NVarChar, classInfo.ClassCode, 30);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlFillTeacherClassByClassInfo);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.TeacherClass teacherClass = new Core.Business.TeacherClass();

                    if (!reader.IsDBNull(0)) teacherClass.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) teacherClass.TeacherCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) teacherClass.ClassCode = reader.GetString(2);
                    if (!reader.IsDBNull(3)) teacherClass.IsState = reader.GetBoolean(3);

                    teacherClass.MarkOld();
                    teacherClasslist.Add(teacherClass);
                }
                reader.Close();
            }
            return teacherClasslist;
        }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例9: AnalyzeMember

        private Issue AnalyzeMember(MemberInfo memberInfo, SemanticModel model, ClassInfo classInfo)
        {
            foreach (BlockSyntax block in memberInfo.Blocks)
            {
                var identifiers = block.DescendantNodes().OfType<IdentifierNameSyntax>().ToList();

                foreach (IdentifierNameSyntax identifierName in identifiers)
                {
                    SymbolInfo identifierSymbol = model.GetSymbolInfo(identifierName);

                    //Does this symbol refer to a GuardedField?
                    GuardedFieldInfo foundGuardedField = classInfo.GuardedFields.FirstOrDefault(field => field.Symbol == identifierSymbol.Symbol);

                    if (foundGuardedField != null)
                    {
                        //We must be inside a lock statement
                        LockHierarchy controlFlowHierarchy = CreateLockHiearchyFromIdentifier(identifierName);

                        bool lockHierarchySatisfied = LockHierarchy.IsSatisfiedBy(foundGuardedField.DeclaredLockHierarchy, controlFlowHierarchy);

                        if (!lockHierarchySatisfied)
                        {
                            return new Issue(
                                ErrorCode.GUARDED_FIELD_ACCESSED_OUTSIDE_OF_LOCK,
                                identifierName,
                                identifierSymbol.Symbol);
                        }
                    }
                }
            }

            return null;
        }
开发者ID:flashcurd,项目名称:ThreadSafetyAnnotations,代码行数:33,代码来源:GuardedFieldAccessedOutsideOfLock.cs

示例10: MethodNotFoundException

 public MethodNotFoundException(ClassInfo classInfo, string methodName)
     : base("Method '" + methodName + "' not found in class '"
            + classInfo.Name + "'")
 {
     this.MethodName = methodName;
     this.ClassInfo = classInfo;
 }
开发者ID:dbremner,项目名称:dotnet-testability-explorer,代码行数:7,代码来源:MethodNotFoundException.cs

示例11: Parse

        public Class Parse(String json, String className)
        {
            Class result = new Class(AccessModifier.Public, className);

            var oo = JsonConvert.DeserializeObject(json);
            var c = new ClassInfo(className);
            if (oo is JArray)
            {
                foreach (var jo in (JArray)oo)
                {
                    if (jo is JObject)
                    {
                        SetProperties(c, (JObject)jo);
                    }
                    else if (jo is JValue)
                    {
                        var pi = new PropertyInfo();
                        pi.Validate(jo);
                        return new Class(AccessModifier.Public, pi.GetCSharpTypeName());
                    }
                }
            }
            else if (oo is JObject)
            {
                SetProperties(c, (JObject)oo);
            }
            SetProperties(result, c);

            return result;
        }
开发者ID:fengweijp,项目名称:higlabo,代码行数:30,代码来源:JsonParser.cs

示例12: MethodInfo

 /// <summary>Constructor.</summary>
 /// <param name="classInfo">The test-class that this method is a member of.</param>
 /// <param name="name">The name of the method.</param>
 public MethodInfo(ClassInfo classInfo, string name)
 {
     this.classInfo = classInfo;
     this.name = name;
     displayName = FormatName(name);
     isSpecial = MethodHelper.IsSpecial(Name);
 }
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:10,代码来源:MethodInfo.cs

示例13: ClassListItem

        /// <summary>Constructor.</summary>
        /// <param name="classInfo">The test-class this node represents.</param>
        public ClassListItem(ClassInfo classInfo)
        {
            // Setup initial conditions.
            this.classInfo = classInfo;

            // Set default values.
            Text = classInfo.DisplayName;
        }
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:10,代码来源:ClassListItem.cs

示例14: compute

 /**
    * Computing the ClassCost for a ClassInfo involves tallying up all the MethodCosts contained
    * in the class. Then an overall cost is calculated, based on the {@code CostModel} the metric
    * computer is using.
    *
    * @param clazz to compute the metric for.
    * @return classCost
    */
 public ClassCost compute(ClassInfo clazz)
 {
     IList<MethodCost> methods = new ArrayList<MethodCost>();
     foreach (MethodInfo method in clazz.GetMethods())
     {
         methods.Add(compute(method));
     }
     return new ClassCost(clazz.Name, methods);
 }
开发者ID:dbremner,项目名称:dotnet-testability-explorer,代码行数:17,代码来源:MetricComputer.cs

示例15: FieldInfo

 public FieldInfo(string fieldName, ClassInfo fieldClass, bool isPrimitive, bool isArray
     , bool isNArray)
 {
     _fieldName = fieldName;
     _fieldClass = fieldClass;
     _isPrimitive = isPrimitive;
     _isArray = isArray;
     _isNArray = isNArray;
 }
开发者ID:masroore,项目名称:db4o,代码行数:9,代码来源:FieldInfo.cs


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