ColonelPanic

SQLSelectExtension

Apr 21st, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. public static class SQLSelectExtensions
  2. {
  3.     public static IEnumerable<T> Records<T>(this SQLSelect select)
  4.     {
  5.         int counter = 1;
  6.         int size = select.GetCount();
  7.  
  8.         using(UnmanagedStruct<T> record = new UnmanagedStruct<T>())
  9.         {
  10.             while (counter <= size)
  11.             {
  12.                 if (select.GetNth(record.Handle, counter) == 0)
  13.                 {
  14.                     counter++;
  15.                     yield return record.Data;
  16.                 }
  17.             }
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment