バージョン

IKeyedSubObjectEx インターフェース

キーの比較を最適化するためにキーのインターンされた小文字バージョンをキャッシュするサブオブジェクトによって使用されるインターフェイス
シンタックス
'宣言
 
Public Interface IKeyedSubObjectEx 
   Inherits IKeyedSubObject 
public interface IKeyedSubObjectEx : IKeyedSubObject  
使用例
Private KeyValue As String = ""
Private KeyInternedValue As String = ""
Private KeyLowercaseInternedValue As String = ""

Public ReadOnly Property KeyLowercaseInterned() As String Implements Infragistics.Shared.IKeyedSubObjectEx.KeyLowercaseInterned

    Get
        If Me.KeyValue.Length = 0 Then Return Me.KeyValue

        ' If the string hasn't changed since the last internment
        ' then return the cached value
        If Object.ReferenceEquals(Me.KeyValue, Me.KeyInternedValue) = True Then
            If Not Me.KeyLowercaseInternedValue Is Nothing Then
                Return Me.KeyLowercaseInternedValue
            End If
        End If

        ' Intern the key and save the interned string reference
        Me.KeyInternedValue = String.Intern(Me.KeyValue)

        ' Intern the string converted to lowercase so we can do case
        ' insensitive compares
        Me.KeyLowercaseInternedValue = String.Intern(Me.KeyInternedValue.ToLower())

        Return Me.KeyLowercaseInternedValue

    End Get

End Property
private string keyInterned;
private string keyLowercaseInterned;
private string key = "";

string IKeyedSubObjectEx.KeyLowercaseInterned
{

	get 
	{
		string key = this.key;
		
		if ( key == null || key.Length == 0 )
			return key;
		
		// If the string hasn't changed since the last internment
		// then return the cached value
		if ( object.ReferenceEquals( key, this.keyInterned ) )
		{
			if ( this.keyLowercaseInterned != null )
				return this.keyLowercaseInterned;
		}
		
		// Intern the key and save the interned string reference
		//
		this.keyInterned = string.Intern( key );
		
		// Intern the string converted to lowercase so we can do case
		// insensitive compares
		//
		this.keyLowercaseInterned = string.Intern( this.keyInterned.ToLower() );
		
		return this.keyLowercaseInterned;
	}

}
参照