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


C# DeclSpace.LookupNamespaceOrType方法代码示例

本文整理汇总了C#中Mono.CSharp.DeclSpace.LookupNamespaceOrType方法的典型用法代码示例。如果您正苦于以下问题:C# DeclSpace.LookupNamespaceOrType方法的具体用法?C# DeclSpace.LookupNamespaceOrType怎么用?C# DeclSpace.LookupNamespaceOrType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.CSharp.DeclSpace的用法示例。


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

示例1: FindDocumentedTypeNonArray

 private static TypeSpec FindDocumentedTypeNonArray(MemberCore mc, 
     string identifier, DeclSpace ds, string cref, Report r)
 {
     switch (identifier) {
     case "int":
         return TypeManager.int32_type;
     case "uint":
         return TypeManager.uint32_type;
     case "short":
         return TypeManager.short_type;;
     case "ushort":
         return TypeManager.ushort_type;
     case "long":
         return TypeManager.int64_type;
     case "ulong":
         return TypeManager.uint64_type;;
     case "float":
         return TypeManager.float_type;;
     case "double":
         return TypeManager.double_type;
     case "char":
         return TypeManager.char_type;;
     case "decimal":
         return TypeManager.decimal_type;;
     case "byte":
         return TypeManager.byte_type;;
     case "sbyte":
         return TypeManager.sbyte_type;;
     case "object":
         return TypeManager.object_type;;
     case "bool":
         return TypeManager.bool_type;;
     case "string":
         return TypeManager.string_type;;
     case "void":
         return TypeManager.void_type;;
     }
     FullNamedExpression e = ds.LookupNamespaceOrType (identifier, 0, mc.Location, false);
     if (e != null) {
         if (!(e is TypeExpr))
             return null;
         return e.Type;
     }
     int index = identifier.LastIndexOf ('.');
     if (index < 0)
         return null;
     int warn;
     TypeSpec parent = FindDocumentedType (mc, identifier.Substring (0, index), ds, cref, r);
     if (parent == null)
         return null;
     // no need to detect warning 419 here
     var ts = FindDocumentedMember (mc, parent,
         identifier.Substring (index + 1),
         null, ds, out warn, cref, false, null, r) as TypeSpec;
     if (ts != null)
         return ts;
     return null;
 }
开发者ID:speier,项目名称:shake,代码行数:58,代码来源:doc.cs

示例2: FindDocumentedTypeNonArray

		private static TypeSpec FindDocumentedTypeNonArray (MemberCore mc, 
			string identifier, DeclSpace ds, string cref, Report r)
		{
			var types = mc.Module.Compiler.BuiltinTypes;
			switch (identifier) {
			case "int":
				return types.Int;
			case "uint":
				return types.UInt;
			case "short":
				return types.Short;
			case "ushort":
				return types.UShort;
			case "long":
				return types.Long;
			case "ulong":
				return types.ULong;
			case "float":
				return types.Float;
			case "double":
				return types.Double;
			case "char":
				return types.Char;
			case "decimal":
				return types.Decimal;
			case "byte":
				return types.Byte;
			case "sbyte":
				return types.SByte;
			case "object":
				return types.Object;
			case "bool":
				return types.Bool;
			case "string":
				return types.String;
			case "void":
				return types.Void;
			}
			FullNamedExpression e = ds.LookupNamespaceOrType (identifier, 0, mc.Location, false);
			if (e != null) {
				if (!(e is TypeExpr))
					return null;
				return e.Type;
			}
			int index = identifier.LastIndexOf ('.');
			if (index < 0)
				return null;

			var nsName = identifier.Substring (0, index);
			var typeName = identifier.Substring (index + 1);
			Namespace ns = ds.NamespaceEntry.NS.GetNamespace (nsName, false);
			ns = ns ?? mc.Module.GlobalRootNamespace.GetNamespace(nsName, false);
			if (ns != null) {
				var te = ns.LookupType(mc, typeName, 0, true, mc.Location);
				if(te != null)
					return te.Type;
			}

			int warn;
			TypeSpec parent = FindDocumentedType (mc, identifier.Substring (0, index), ds, cref, r);
			if (parent == null)
				return null;
			// no need to detect warning 419 here
			var ts = FindDocumentedMember (mc, parent,
				identifier.Substring (index + 1),
				null, ds, out warn, cref, false, null, r) as TypeSpec;
			if (ts != null)
				return ts;
			return null;
		}
开发者ID:poke,项目名称:monodevelop,代码行数:70,代码来源:doc.cs


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