Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static T Clone<T>(this T source) where T : class
- {
- T nobj = (T)Activator.CreateInstance(typeof(T));
- var props = typeof(T).GetProperties();
- foreach (var p in props)
- {
- p.SetValue(nobj, p.GetValue(source));
- }
- return nobj;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement