RTI Connext C# API  6.1.0
LoanedSamples< T > Class Template Reference

Provides temporary access to a collection of samples (data and info). More...

Inherits IEnumerable< LoanedSample< T >>, and IDisposable.

Public Member Functions

IEnumerator< LoanedSample< T > > GetEnumerator ()
 Provides access to the samples More...
 
void Dispose ()
 Returns the loaned samples back to the DataReader. More...
 
IEnumerable< T > ValidData ()
 Provides access only to the data samples with valid data, skipping samples such that SampleInfo.ValidData is false. More...
 
GetDataAt (int index)
 Equivalent to this[index].Data More...
 

Properties

int Count [get]
 Returns the number of samples More...
 
LoanedSample< T > this[uint index] [get]
 Provides indexed access to the samples More...
 

Detailed Description

Provides temporary access to a collection of samples (data and info).

Template Parameters
TThe topic-type of the DataReader<T>

This collection needs to be explicitly disposed when it is no longer needed (typically with a using statement). The underlying middleware resources it uses will not be released by the garbage collector.

After disposing the collection, its elements and all their references are no longer valid and cannot be accessed. To keep the data around, you can copy it.

See also
Reading data for code examples

Member Function Documentation

◆ Dispose()

void Dispose ( )

Returns the loaned samples back to the DataReader.

◆ GetDataAt()

T GetDataAt ( int  index)

Equivalent to this[index].Data

◆ GetEnumerator()

IEnumerator<LoanedSample<T> > GetEnumerator ( )

Provides access to the samples

◆ ValidData()

IEnumerable<T> ValidData ( )

Provides access only to the data samples with valid data, skipping samples such that SampleInfo.ValidData is false.

Property Documentation

◆ Count

int Count
get

Returns the number of samples

◆ this[uint index]

LoanedSample<T> this[uint index]
get

Provides indexed access to the samples