Browse Source

Added helper Linq method to return an enumeration without its last element.

pull/1/head
triton 13 years ago
parent
commit
f23600caf5
  1. 18
      src/Generator/Utils/Utils.cs

18
src/Generator/Utils/Utils.cs

@ -207,6 +207,24 @@ namespace CppSharp
} }
} }
public static class LinqHelpers
{
public static IEnumerable<T> WithoutLast<T>(this IEnumerable<T> xs)
{
T lastX = default(T);
var first = true;
foreach (var x in xs)
{
if (first)
first = false;
else
yield return lastX;
lastX = x;
}
}
}
public static class AssemblyHelpers public static class AssemblyHelpers
{ {
public static IEnumerable<System.Type> FindDerivedTypes(this Assembly assembly, public static IEnumerable<System.Type> FindDerivedTypes(this Assembly assembly,

Loading…
Cancel
Save