次の方法で共有


MemberCollection Class

PositionLevel、または Tuple に含まれる Member オブジェクトの読み取り専用の要求時コレクションを取得します。

名前空間: Microsoft.AnalysisServices.AdomdClient
アセンブリ: Microsoft.AnalysisServices.AdomdClient (microsoft.analysisservices.adomdclient.dll 内)

構文

'宣言
<DefaultMemberAttribute("Item")> _
Public NotInheritable Class MemberCollection
    Implements ICollection, IEnumerable
[DefaultMemberAttribute("Item")] 
public sealed class MemberCollection : ICollection, IEnumerable
[DefaultMemberAttribute(L"Item")] 
public ref class MemberCollection sealed : ICollection, IEnumerable
/** @attribute DefaultMemberAttribute("Item") */ 
public final class MemberCollection implements ICollection, IEnumerable
DefaultMemberAttribute("Item") 
public final class MemberCollection implements ICollection, IEnumerable

解説

MemberCollection は、外部的には Member オブジェクトのコレクションを表し、内部的にはコレクションの親に応じて次の 2 つのうちいずれかの方法で読み込まれ、管理されます。

  • Tuple の場合のように、親オブジェクトがクエリの結果として参照された場合、コレクションはそのクエリによって参照されたメンバを表します。

  • 親オブジェクトがメタデータの要求の結果として参照された場合、コレクションは親オブジェクトの定義により参照されたメンバを表します。

継承階層

System.Object
  Microsoft.AnalysisServices.AdomdClient.MemberCollection

使用例

次のサブルーチンでは、Level を受け取り、MemberCollection の繰り返し処理を実行し、各メンバの情報を表示します。

Public Overloads Sub ListMembers(ByRef LevelToCheck As Level)

    ' Check the parameter before performing actions on it.
    If LevelToCheck Is Nothing Then
        Throw New System.ArgumentNullException("LevelToCheck")
    Else
        ' Iterate through the Members collection of the
        ' Level object.

        Try
            Dim memberToCheck As Member

            Debug.WriteLine("Found " & LevelToCheck.GetMembers().Count& _
                " member(s) in level:")

            For Each memberToCheck In LevelToCheck.GetMembers()
                Debug.WriteLine("Member:  " & memberToCheck.Name)
                Debug.WriteLine("  Caption:          " & _
                    memberToCheck.Caption)
                Debug.WriteLine("  UniqueName:       " & _
                    memberToCheck.UniqueName)

                ' Note that the Children property loads a collection
                ' of Member objects on demand and
                ' therefore, slows performance when first
                ' referenced--you should instead use the 
                ' ChildCount property.
                Debug.WriteLine("  No. of children:  " & _
                    memberToCheck.ChildCount)
            Next
        Catch ex As AdomdConnectionException
            ' The connection could not be opened or was disconnected.
            ' This error can occur at any time, if the provider is 
            ' disconnected from the server.
            Debug.WriteLine(ex)
            Throw ex
        Catch ex As AdomdErrorResponseException
            ' A response is received from a provider which indicates an error.
            Debug.WriteLine(ex)
            Throw ex
        Catch ex As AdomdUnknownResponseException
            ' A response has been returned from the provider that 
            ' was not understood.
            Debug.WriteLine(ex)
            Throw ex
        Catch ex As AdomdCacheExpiredException
            ' A cached version of an ADOMD.NET object is no longer valid.
            ' This error is typically raised when reviewing metadata.
            Debug.WriteLine(ex)
            Throw ex
        Catch ex As AdomdException
            ' Any other error raised by ADOMD.NET.
            Debug.WriteLine(ex)
            Throw ex
        Catch ex As Exception
            ' Any other error.
            Debug.WriteLine(ex)
            Throw ex        End Try
    End If
End Sub

スレッド セーフ

この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

MemberCollection Members
Microsoft.AnalysisServices.AdomdClient Namespace