本文整理汇总了C#中ITypeDefinition.GetProjectContent方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeDefinition.GetProjectContent方法的具体用法?C# ITypeDefinition.GetProjectContent怎么用?C# ITypeDefinition.GetProjectContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeDefinition
的用法示例。
在下文中一共展示了ITypeDefinition.GetProjectContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertType
NSObjectTypeInfo ConvertType (TypeSystemService.ProjectContentWrapper dom, ITypeDefinition type)
{
string objcName = null;
bool isModel = false;
bool registeredInDesigner = true;
foreach (var att in type.Attributes) {
var attType = att.AttributeType;
if (attType.Equals (Resolve (dom, registerAttType))) {
if (type.GetProjectContent () != null) {
registeredInDesigner &=
MonoDevelop.DesignerSupport.CodeBehind.IsDesignerFile (att.Region.FileName);
}
//type registered with an explicit type name are up to the user to provide a valid name
var posArgs = att.PositionalArguments;
if (posArgs.Count == 1 || posArgs.Count == 2)
objcName = posArgs [0].ConstantValue as string;
//non-nested types in the root namespace have names accessible from obj-c
else if (string.IsNullOrEmpty (type.Namespace) && type.Name.IndexOf ('.') < 0)
objcName = type.Name;
}
if (attType.Equals (Resolve (dom, modelAttType)))
isModel = true;
}
if (string.IsNullOrEmpty (objcName))
return null;
string baseType = type.DirectBaseTypes.First ().ReflectionName;
if (baseType == "System.Object")
baseType = null;
bool isUserType = !type.ParentAssembly.Equals (Resolve (dom, nsobjectType).ParentAssembly);
var info = new NSObjectTypeInfo (objcName, type.ReflectionName, null, baseType, isModel, isUserType, registeredInDesigner);
if (info.IsUserType) {
UpdateTypeMembers (dom, info, type);
info.DefinedIn = type.Parts.Select (p => (string) p.Region.FileName).ToArray ();
}
return info;
}