本文整理汇总了C#中ClassInfo类的典型用法代码示例。如果您正苦于以下问题:C# ClassInfo类的具体用法?C# ClassInfo怎么用?C# ClassInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassInfo类属于命名空间,在下文中一共展示了ClassInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: GetAccounts
public static List<Account> GetAccounts(
string name,
int gender,
string bloodType,
int birthYear,
int birthMonth,
int birthDate,
City hometownCity,
Province homwtownProvince,
City resideCity,
Province resideProvince,
ClassInfo classInfo,
Grade grade,
Major major,
College college,
University university,
string code,
bool? hasAvatar,
string nickName,
bool? isProtected,
int minViewCount,
int maxViewCount,
bool? isPublic,
int minYear,
int maxYear,
string interest,
PagingInfo pagingInfo)
{
return provider.GetAccounts(
name,
gender,
bloodType,
birthYear,
birthMonth,
birthDate,
hometownCity,
homwtownProvince,
resideCity,
resideProvince,
classInfo,
grade,
major,
college,
university,
code,
hasAvatar,
nickName,
isProtected,
minViewCount,
maxViewCount,
isPublic,
minYear,
maxYear,
interest,
pagingInfo);
}
开发者ID:dalinhuang,项目名称:ume-v3,代码行数:56,代码来源:AccountService.cs
示例17: ChangedObjectInfo
public ChangedObjectInfo(ClassInfo oldCi, ClassInfo newCi, int fieldIndex, AbstractObjectInfo oldValue,
AbstractObjectInfo newValue, string message, int objectRecursionLevel)
{
_oldCi = oldCi;
_newCi = newCi;
_fieldIndex = fieldIndex;
_oldValue = oldValue;
_newValue = newValue;
_message = message;
_objectRecursionLevel = objectRecursionLevel;
}
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:11,代码来源:ChangedObjectInfo.cs
示例18: CheckClass
private void CheckClass(IDictionary<Type, ClassInfo> currentCIs, ClassInfo persistedCI)
{
var currentCI = currentCIs[persistedCI.UnderlyingType];
var classInfoCompareResult = persistedCI.ExtractDifferences(currentCI, true);
if (!classInfoCompareResult.IsCompatible())
throw new OdbRuntimeException(NDatabaseError.IncompatibleMetamodel.AddParameter(currentCI.ToString()));
if (classInfoCompareResult.HasCompatibleChanges())
_results.Add(classInfoCompareResult);
}
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:11,代码来源:MetaModelCompabilityChecker.cs
示例19: NonNativeObjectInfo
public NonNativeObjectInfo(ObjectInfoHeader oip, ClassInfo classInfo) : base(null)
{
_classInfo = classInfo;
_objectHeader = oip;
if (classInfo != null)
{
_maxNbattributes = classInfo.MaxAttributeId;
_attributeValues = new AbstractObjectInfo[_maxNbattributes];
}
}
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:11,代码来源:NonNativeObjectInfo.cs
示例20: UpdateScore
public void UpdateScore()
{
//checks for score things, sets them to black
bool hasAPlus = false;
ClassInfo[] plusCubes = new ClassInfo[]{grid[0,0]}; // or it throws an error
int rowAt = 1;
int colAt = 1;
//for all center columns
while (colAt != yMax-1 && hasAPlus == false) {
//check for a +
while (rowAt != xMax-1) {
if (grid [rowAt - 1, colAt].IsColor () && grid [rowAt, colAt].IsColor () && grid [rowAt + 1, colAt].IsColor ()
&& grid [rowAt, colAt + 1].IsColor () && grid [rowAt, colAt - 1].IsColor ()) {
hasAPlus = true;
plusCubes = new ClassInfo[]{grid [rowAt - 1, colAt], grid [rowAt, colAt], grid [rowAt + 1, colAt], grid [rowAt, colAt + 1], grid [rowAt, colAt - 1]};
}
if (grid [rowAt, colAt - 1].IsColor () && grid [rowAt, colAt].IsColor () && grid [rowAt, colAt + 1].IsColor ()
&& grid [rowAt + 1, colAt].IsColor () && grid [rowAt - 1, colAt].IsColor ()) {
hasAPlus = true;
plusCubes = new ClassInfo[]{grid [rowAt, colAt - 1], grid [rowAt, colAt], grid [rowAt, colAt + 1], grid [rowAt + 1, colAt], grid [rowAt - 1, colAt]};
}
rowAt++;
}
colAt++;
rowAt = 1;
}
if (hasAPlus) {
Color baseColor = plusCubes[0].GetColor ();
if(plusCubes[1].GetColor ()==baseColor && plusCubes[2].GetColor ()==baseColor && plusCubes[3].GetColor ()==baseColor && plusCubes[4].GetColor ()==baseColor){
score = score + plusScoreOne;
int changingAt=0;
while(changingAt < 5){
plusCubes[changingAt].SetColor(Color.black);
changingAt++;
}
}
else{if(
(plusCubes[1].GetColor () != baseColor && plusCubes[2].GetColor () != baseColor && plusCubes[3].GetColor () != baseColor && plusCubes[4].GetColor () != baseColor)
&& (plusCubes[2].GetColor () != plusCubes[1].GetColor () && plusCubes[3].GetColor () != plusCubes[1].GetColor () && plusCubes[4].GetColor () != plusCubes[1].GetColor ())
&& (plusCubes[3].GetColor () != plusCubes[2].GetColor () && plusCubes[4].GetColor () != plusCubes[2].GetColor ())
&& (plusCubes[4].GetColor () != plusCubes[3].GetColor ())
){
score = score + plusScoreMany;
int changingAt=0;
while(changingAt < 5){
plusCubes[changingAt].SetColor(Color.gray);
changingAt++;
}
}
}//if all diffrent colors
}
}
开发者ID:JGoldsmith6321,项目名称:WIGP-Final-Project,代码行数:53,代码来源:MainBoard.cs
注:本文中的ClassInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论