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

📄 abstractnamedentity.cs

📁 全功能c#编译器
💻 CS
字号:
// <file>
//     <copyright see="prj:///doc/copyright.txt"/>
//     <license see="prj:///doc/license.txt"/>
//     <owner name="?" email="?"/>
//     <version value="$version"/>
// </file>

using System;
using System.Collections;

namespace SharpDevelop.Internal.Parser
{
	[Serializable]
	public abstract class AbstractNamedEntity : AbstractDecoration
	{
		static char[] nameDelimiters = new char[] { '.', '+' };
//		public static Hashtable fullyQualifiedNames = new Hashtable();
		string fullyQualifiedName = null;
//		int nameHashCode = -1;
		
		public virtual string FullyQualifiedName {
			get {
				if (fullyQualifiedName == null) {
					return String.Empty;
				}
				
				return fullyQualifiedName;
//				return (string)fullyQualifiedNames[nameHashCode];
			}
			set {
				fullyQualifiedName = value;
//				nameHashCode = value.GetHashCode();
//				if (fullyQualifiedNames[nameHashCode] == null) {
//					fullyQualifiedNames[nameHashCode] = value;
//				}
			}
		}
		
		
		public virtual string Name {
			get {
				if (FullyQualifiedName != null) {
					int lastIndex;
					
					if (CanBeSubclass) {
						lastIndex = FullyQualifiedName.LastIndexOfAny(nameDelimiters);
					} else {
						lastIndex = FullyQualifiedName.LastIndexOf('.');
					}
					
					if (lastIndex < 0) {
						return FullyQualifiedName;
					} else {
						return FullyQualifiedName.Substring(lastIndex + 1);
					}
				}
				return null;
			}
		}

		public virtual string Namespace {
			get {
				if (FullyQualifiedName != null) {
					int lastIndex = FullyQualifiedName.LastIndexOf('.');
					
					if (lastIndex < 0) {
						return String.Empty;
					} else {
						return FullyQualifiedName.Substring(0, lastIndex);
					}
				}
				return null;
			}
		}
		
		protected virtual bool CanBeSubclass {
			get {
				return false;
			}
		}
	}
}

⌨️ 快捷键说明

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