'宣言 Protected Overloads Shared Function ExtractExistingElement( _ ByVal existingElements As ArrayList, _ ByVal type As Type, _ ByVal removeExtractedElement As Boolean _ ) As Object
protected static object ExtractExistingElement( ArrayList existingElements, Type type, bool removeExtractedElement )
Imports Infragistics.Win Imports System.Collections Private Function GetButtonElement(ByVal childElementsCollection As ArrayList) As Infragistics.Win.ButtonUIElement ' ChildElements コレクションで使用可能なボタン ' UIElement があるかどうかを確認します Dim btn As ButtonUIElement = ExtractExistingElement(childElementsCollection, GetType(ButtonUIElement), True) ' ない場合、新しいボタンをインスタンス化します If btn Is Nothing Then btn = New ButtonUIElement(Me) End If Return btn End Function
using Infragistics.Win; using System.Collections; private Infragistics.Win.ButtonUIElement GetButtonElement(System.Collections.ArrayList childElementsCollection) { // ChildElements コレクションで使用可能なボタン // UIElement があるかどうかを確認します Infragistics.Win.ButtonUIElement button = ExtractExistingElement(childElementsCollection, typeof(Infragistics.Win.ButtonUIElement),true) as Infragistics.Win.ButtonUIElement ; // そうでない場合、新しいボタンをインスタンスを作成します if(null == button) button = new Infragistics.Win.ButtonUIElement(this); return button; }