Nevron Open Vision Documentation
CLR Interop

NOV Data Structures are as clean as possible from .NET interface dependencies. In some cases however, it is required to wrap an implementation of a specific NOV Data Structures interface and expose it as a .NET interface and vice-versa. This wrapping process is known as adaptation, since it uses the adapter design pattern - an intermediate adapter object is created that implements the target interface and takes as input the adapted interface. In NOV the adaptation to/from NOV Data Structures interfaces is exposed by static methods of the NCLRAdapt<T> static class.

The following example demonstrates how to use a foreach loop, to iterate through the items of a NList<T>.

NCLRAdapt Sample
Copy Code
NList<string> fruits = new NList<string>();
foreach (string fruit in NCLRAdapt<string>.ToIEnumerable(fruits))

The following table summarizes the currently possible conversions exposed by the methods of the NCLRAdapt<T> static class:

Function Description


IEnumerator<T> ToIEnumerator(INIterator<T> it)

Adapts an INIterator<T> as an IEnumerator<T>

IEnumerable<T> ToIEnumerable(INIterable<T> it)

Adapts an INIterable<T> as an IEnumerable<T>


INIterator<T> ToINIterator(IEnumerator<T> en)

Adapts an IEnumerator<T> as an INIterator<T>

INIterable<T> ToINIterable(IEnumerable<T> enumerable)

Adapts an IEnumerable<T> as an INIterable<T>

INArray<T> ToINArray(T[] arr)

Adapts a .NET one dimensional array as INArray<T>

Send Feedback