int16collection.cs
来自「另一新版ajax组件」· CS 代码 · 共 73 行
CS
73 行
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 + =
减小字号Ctrl + -
显示快捷键?