Guest User

Untitled

a guest
Jul 2nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using System.Linq;
  2.  
  3. namespace TestLinq
  4. {
  5.     class Data
  6.     {
  7.         public static object GetUsers()
  8.         {
  9.             using (var db = new MappingDataContext("TestLinq.Properties.Settings.reifitonConnectionString"))
  10.             {
  11.                 return (from u in db.Users
  12.                         select new
  13.                                 {
  14.                                     user = u.Name,
  15.                                     password = u.Password
  16.                                 }).SingleOrDefault();
  17.             }
  18.         }
  19.  
  20.         public static T Cast<T>(object obj, T type)
  21.         {
  22.             return (T)obj;
  23.         }
  24.     }
  25. }
Add Comment
Please, Sign In to add comment