📄 int16collection.cs
字号:
using System;
using System.Collections;
namespace AJAXDemo.Examples.Collections
{
public class Int16Collection : CollectionBase
{
public Int16 this[ int index ]
{
get
{
return( (Int16) List[index] );
}
set
{
List[index] = value;
}
}
public int Add( Int16 value )
{
return( List.Add( value ) );
}
public int IndexOf( Int16 value )
{
return( List.IndexOf( value ) );
}
public void Insert( int index, Int16 value )
{
List.Insert( index, value );
}
public void Remove( Int16 value )
{
List.Remove( value );
}
public bool Contains( Int16 value )
{
// If value is not of type Int16, this will return false.
return( List.Contains( value ) );
}
protected override void OnInsert( int index, Object value )
{
if ( value.GetType() != Type.GetType("System.Int16") )
throw new ArgumentException( "value must be of type Int16.", "value" );
}
protected override void OnRemove( int index, Object value )
{
if ( value.GetType() != Type.GetType("System.Int16") )
throw new ArgumentException( "value must be of type Int16.", "value" );
}
protected override void OnSet( int index, Object oldValue, Object newValue )
{
if ( newValue.GetType() != Type.GetType("System.Int16") )
throw new ArgumentException( "newValue must be of type Int16.", "newValue" );
}
protected override void OnValidate( Object value )
{
if ( value.GetType() != Type.GetType("System.Int16") )
throw new ArgumentException( "value must be of type Int16." );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -