diff --git a/Core/Extensions/InteropExtensions.cs b/Core/Extensions/InteropExtensions.cs
index 675f83f2..67e6b416 100644
--- a/Core/Extensions/InteropExtensions.cs
+++ b/Core/Extensions/InteropExtensions.cs
@@ -40,6 +40,22 @@ namespace Vanara.Extensions
/// true if the specified type is nullable; otherwise, false.
public static bool IsNullable(this Type type) => type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
+ /// Marshals an unmanaged linked list of structures to an of that structure.
+ /// Type of native structure used by the unmanaged linked list.
+ /// The pointing to the native array.
+ /// The expression to be used to fetch the pointer to the next item in the list.
+ /// An exposing the elements of the linked list.
+ public static IEnumerable LinkedListToIEnum(this IntPtr ptr, Func next)
+ {
+ for (var pCurrent = ptr; pCurrent != IntPtr.Zero; )
+ {
+ var ret = pCurrent.ToStructure();
+ yield return ret;
+ pCurrent = next(ret);
+ }
+ yield break;
+ }
+
/// Marshals data from a managed list of specified type to a pre-allocated unmanaged block of memory.
///
/// A type of the enumerated managed object that holds the data to be marshaled. The object must be a structure or an instance of a formatted class.