Compartilhar via


collection_adapter::size (STL/CLR)

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at collection_adapter::size (STL/CLR).

Counts the number of elements.

Syntax

size_type size();  

Remarks

The member function returns the length of the controlled sequence. It is not defined in a specialization for IEnumerable or IEnumerable<Value>.

Example

// cliext_collection_adapter_size.cpp   
// compile with: /clr   
#include <cliext/adapter>   
#include <cliext/deque>   
  
typedef cliext::collection_adapter<   
    System::Collections::ICollection> Mycoll;   
int main()   
    {   
    cliext::deque<wchar_t> d6x(6, L'x');   
    Mycoll c1(%d6x);   
  
// display initial contents " x x x x x x"   
    for each (wchar_t elem in c1)   
        System::Console::Write(" {0}", elem);   
    System::Console::WriteLine();   
    System::Console::WriteLine("size() = {0}", c1.size());   
    return (0);   
    }  
  
 x x x x x x  
size
() = 6  

Requirements

Header: <cliext/adapter>

Namespace: cliext

See Also

collection_adapter (STL/CLR)