📄 interfacecollection.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.Reflection;
using System.Collections;
namespace NewClassWizard
{
public class InterfaceCollection : DictionaryBase
{
public InterfaceCollection()
{
}
public void Add( Type interfaceType )
{
if ( interfaceType == null )
throw new NullReferenceException();
if ( !interfaceType.IsInterface )
throw new ArgumentException( "The specified type is not an interface" );
IDictionary dict = base.Dictionary;
string key = InterfaceCollection.InterfaceKey( interfaceType );
if ( dict.Contains( key ) == false )
dict.Add( key, interfaceType );
}
public ArrayList GetInterfaces()
{
return new ArrayList( base.Dictionary.Values );
//IDictionary dict = base.Dictionary;
//dict.Values.CopyTo(outArray, 0);
//outArray.AddRange( base.Dictionary );
/*
IEnumerator interfaces = base.GetEnumerator();
DictionaryEntry entry;
while ( interfaces.MoveNext() )
{
entry = (DictionaryEntry)interfaces.Current;
outArray.Add( (Type)entry.Value );
}
*/
//return outArray.ToArray( typeof(Type) );
}
public void Remove( Type interfaceType )
{
IDictionary dict = base.Dictionary;
dict.Remove( InterfaceCollection.InterfaceKey( interfaceType ) );
}
public static string InterfaceKey( Type i )
{
return i.Namespace + "." + i.Name;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -