private void ProcessData(Condition _) { Console.WriteLine("---- Data available ----\n"); using (subscriber.BeginAccess()) // Begin coherent access { // Get the list of readers with samples that have not been read yet var readers = subscriber.GetDataReaders(SampleState.NotRead); // Iterate through the returned readers list and take their samples foreach (AnyDataReader reader in readers) { var topicName = reader.TopicDescription.Name; // We're reading the data polymorphically as objects, since // we're only calling the ToString() method. To read the // concrete type, cast down each reader, for example: // if (reader is DataReader<Alarm> alarmReader) { ... } using (LoanedSamples <object> samples = reader.TakeUntyped()) { foreach (LoanedSample <object> sample in samples) { PrintCoheretSetInfo(sample.Info); Console.WriteLine(topicName + " {\n" + sample + "}\n"); } } } } // end coherent access }