⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reflectionreturntype.cs

📁 全功能c#编译器
💻 CS
字号:
// <file>
//     <copyright see="prj:///doc/copyright.txt"/>
//     <license see="prj:///doc/license.txt"/>
//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
//     <version value="$version"/>
// </file>
using System;
using System.Collections;

namespace SharpDevelop.Internal.Parser
{
	[Serializable]
	public class ReflectionReturnType : AbstractReturnType
	{
		public ReflectionReturnType(Type type)
		{
			string fullyQualifiedName = type.FullName.Replace("+", ".").Trim('&');
			
			// base.FullyQualifiedName = fullyQualifiedName.TrimEnd('[', ']', ',', '*');
			for (int i = fullyQualifiedName.Length; i > 0; i--) {
				char c = fullyQualifiedName[i - 1];
				if (c != '[' && c != ']' && c != ',' && c != '*') {
					if (i < fullyQualifiedName.Length)
						fullyQualifiedName = fullyQualifiedName.Substring(0, i);
					break;
				}
			}
			base.FullyQualifiedName = fullyQualifiedName;

			SetPointerNestingLevel(type);
			SetArrayDimensions(type);
			if (arrays == null)
				arrayDimensions = new int[0];
			else
				arrayDimensions = (int[])arrays.ToArray(typeof(int));
		}
		
		ArrayList arrays = null;
		void SetArrayDimensions(Type type)
		{
			if (type.IsArray && type != typeof(Array)) {
				if (arrays == null)
					arrays = new ArrayList();
				arrays.Add(type.GetArrayRank());
				SetArrayDimensions(type.GetElementType());
			}
		}
		
		void SetPointerNestingLevel(Type type)
		{
			if (type.IsPointer) {
				SetPointerNestingLevel(type.GetElementType());
				++pointerNestingLevel;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -