本文整理汇总了C#中IClass类的典型用法代码示例。如果您正苦于以下问题:C# IClass类的具体用法?C# IClass怎么用?C# IClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IClass类属于命名空间,在下文中一共展示了IClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CodeType
/// <summary>
/// Note that projectContent may be different to the IClass.ProjectContent since the class
/// is retrieved from the namespace contents and could belong to a separate project or
/// referenced assembly.
/// </summary>
public CodeType(IProjectContent projectContent, IClass c)
: base(c)
{
this.Class = c;
this.ProjectContent = projectContent;
InfoLocation = GetInfoLocation(projectContent, c);
}
示例2: GetRectangleClass
private IClass GetRectangleClass()
{
var variables = new string[] { "x", "y", "width", "height" };
var methods = new string[]
{
"x ^x",
"y ^y",
"x: newX x := newX",
"y: newY y := newY",
"area ^x*y",
"width ^width",
"height ^height",
"width: newWidth width := newWidth",
"height: newHeight height := newHeight",
"side: newSide x := newSide. y := newSide"
};
if (this.rectangleClass == null)
{
this.rectangleClass = ParserTests.CompileClass(
"Rectangle",
variables,
methods);
}
return this.rectangleClass;
}
示例3: DefaultField
public DefaultField(IReturnType type, string name, ModifierEnum m, DomRegion region, IClass declaringType)
: base(declaringType, name)
{
this.ReturnType = type;
this.Region = region;
this.Modifiers = m;
}
示例4: add_Type
// create
public static TypeDeclaration add_Type(this NamespaceDeclaration namespaceDeclaration, IClass iClass)
{
// move to method IClass.typeDeclaration();
var typeName = iClass.Name;
var newType = namespaceDeclaration.type(typeName); // check if already exists and if it does return it
if (newType != null)
return newType;
const Modifiers modifiers = Modifiers.None | Modifiers.Public;
newType = new TypeDeclaration(modifiers, new List<AttributeSection>());
newType.Name = typeName;
foreach (var baseType in iClass.BaseTypes)
{
if (baseType.FullyQualifiedName != "System.Object") // no need to include this one
newType.BaseTypes.Add(new TypeReference(baseType.FullyQualifiedName));
}
namespaceDeclaration.AddChild(newType);
return newType;
//return namespaceDeclaration.add_Type(iClass.Name);
}
示例5: CreateFileCodeModelNamespace
FileCodeModelCodeNamespace CreateFileCodeModelNamespace(IClass c)
{
var codeNamespace = new FileCodeModelCodeNamespace(compilationUnit.ProjectContent, c.Namespace);
AddCodeElement(codeNamespace);
fileCodeModelNamespaces.Add(codeNamespace);
return codeNamespace;
}
示例6: PrefetchPolicyBuilder
// Indexer declaration
public PrefetchPolicy this[IClass @class]
{
get
{
PrefetchPolicy prefetchPolicy;
if (!this.prefetchPolicyByClass.TryGetValue(@class, out prefetchPolicy))
{
var prefetchPolicyBuilder = new PrefetchPolicyBuilder();
foreach (var roleType in @class.RoleTypes)
{
prefetchPolicyBuilder.WithRule(roleType);
}
foreach (var associationType in @class.AssociationTypes)
{
prefetchPolicyBuilder.WithRule(associationType);
}
prefetchPolicy = prefetchPolicyBuilder.Build();
this.prefetchPolicyByClass[@class] = prefetchPolicy;
}
return prefetchPolicy;
}
}
示例7: AddClassMemberBookmarks
void AddClassMemberBookmarks(IClass c)
{
if (c.IsSynthetic) return;
if (!c.Region.IsEmpty) {
bookmarks.Add(new ClassBookmark(c));
}
foreach (IClass innerClass in c.InnerClasses) {
AddClassMemberBookmarks(innerClass);
}
foreach (IMethod m in c.Methods) {
if (m.Region.IsEmpty || m.IsSynthetic) continue;
bookmarks.Add(new ClassMemberBookmark(m));
}
foreach (IProperty m in c.Properties) {
if (m.Region.IsEmpty || m.IsSynthetic) continue;
bookmarks.Add(new ClassMemberBookmark(m));
}
foreach (IField f in c.Fields) {
if (f.Region.IsEmpty || f.IsSynthetic) continue;
bookmarks.Add(new ClassMemberBookmark(f));
}
foreach (IEvent e in c.Events) {
if (e.Region.IsEmpty || e.IsSynthetic) continue;
bookmarks.Add(new ClassMemberBookmark(e));
}
}
示例8: MakeTypeResult
void MakeTypeResult(IClass c)
{
if (c != null)
resolveResult = new TypeResolveResult(callingClass, resolver.CallingMember, c);
else
ClearResult();
}
示例9: IsValidTestMethod
public bool IsValidTestMethod(IProject project, IClass testClass, IMethod testMethod)
{
if (project == null || testClass == null || testMethod == null)
return false;
return IsValidTestMethod(project, testClass.GetClrName().FullName, testMethod.ShortName);
}
示例10: IsValidTestClass
public bool IsValidTestClass(IProject project, IClass testClass)
{
if (project == null || testClass == null)
return false;
return IsValidTestClass(project, testClass.GetClrName().FullName);
}
示例11: AllorsPredicateRoleInstanceofSql
internal AllorsPredicateRoleInstanceofSql(AllorsExtentFilteredSql extent, IRoleType role, IObjectType instanceType, IClass[] instanceClasses)
{
extent.CheckRole(role);
PredicateAssertions.ValidateRoleInstanceOf(role, instanceType);
this.role = role;
this.instanceClasses = instanceClasses;
}
示例12: ValidateClassNames
public void ValidateClassNames(ValidationContext context, IClass cls)
{
// Property and Role names must be unique within a class hierarchy.
List<string> foundNames = new List<string>();
List<IProperty> allPropertiesInHierarchy = new List<IProperty>();
List<IProperty> superRoles = new List<IProperty>();
FindAllAssocsInSuperClasses(superRoles, cls.SuperClasses);
foreach (IProperty p in cls.GetOutgoingAssociationEnds()) { superRoles.Add(p); }
foreach (IProperty p in superRoles) { allPropertiesInHierarchy.Add(p); }
foreach (IProperty p in cls.Members) { allPropertiesInHierarchy.Add(p); }
foreach (IProperty attribute in allPropertiesInHierarchy)
{
string name = attribute.Name;
if (!string.IsNullOrEmpty(name) && foundNames.Contains(name))
{
context.LogError(
string.Format("Duplicate property or role name '{0}' in class '{1}'", name, cls.Name),
"001", cls);
}
foundNames.Add(name);
}
}
示例13: ClassProxy
public ClassProxy(IClass c)
{
this.FullyQualifiedName = c.FullyQualifiedName;
this.Documentation = c.Documentation;
this.modifiers = c.Modifiers;
this.classType = c.ClassType;
}
示例14: GetSourceFiles
public IEnumerable<OpenedFile> GetSourceFiles(out OpenedFile designerCodeFile)
{
// get new initialize components
ParseInformation info = ParserService.ParseFile(this.viewContent.PrimaryFileName, this.viewContent.PrimaryFileContent);
ICompilationUnit cu = info.CompilationUnit;
foreach (IClass c in cu.Classes) {
if (FormsDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(c)) {
this.currentClassPart = c;
this.initializeComponents = FormsDesignerSecondaryDisplayBinding.GetInitializeComponents(c);
if (this.initializeComponents != null) {
string designerFileName = this.initializeComponents.DeclaringType.CompilationUnit.FileName;
if (designerFileName != null) {
designerCodeFile = FileService.GetOrCreateOpenedFile(designerFileName);
CompoundClass compound = c.GetCompoundClass() as CompoundClass;
if (compound == null) {
return new [] {designerCodeFile};
} else {
return compound.Parts
.Select(cl => FileService.GetOrCreateOpenedFile(cl.CompilationUnit.FileName))
.Distinct();
}
}
}
}
}
throw new FormsDesignerLoadException("Could not find InitializeComponent method in any part of the open class.");
}
示例15: AllorsPredicateAssociationInstanceofSql
internal AllorsPredicateAssociationInstanceofSql(AllorsExtentFilteredSql extent, IAssociationType association, IObjectType instanceType, IClass[] instanceClasses)
{
extent.CheckAssociation(association);
PredicateAssertions.ValidateAssociationInstanceof(association, instanceType);
this.association = association;
this.instanceClasses = instanceClasses;
}