add ToNullTerminatedArray function (for P/Invoke interop)
This commit is contained in:
parent
96c4c6f217
commit
95495ac334
@ -62,5 +62,16 @@ namespace MBS.Framework.Collections.Generic
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static T[] ToNullTerminatedArray<T>(this IEnumerable<T> enumerable) where T : class
|
||||
{
|
||||
List<T> list = new List<T>();
|
||||
foreach (T name in enumerable)
|
||||
{
|
||||
list.Add(name);
|
||||
}
|
||||
list.Add(null);
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user