public virtual void Clone(Object source) { if (source == null) throw new ArgumentNullException("Source"); if (source.GetType() != this.GetType()) throw new ArgumentException("Type Mismatch"); foreach (PropertyInfo p in source.GetType().GetProperties()) if (p.CanRead && p.CanWrite) p.SetValue(this, p.GetValue(source, null), null); }
Wednesday, July 01, 2009
Generic Clone Method C#.NET
Using reflection, this method copies each property of the source object to target object.
Subscribe to:
Post Comments (Atom)
Azure Storage Account Types
Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...
-
Why we need asynchronous tasks? Execute a time consuming operations in parallel to the CLR thread which execute the request If you have ...
-
Demo: I was thinking a way to show images before actually uploading them to server. I would say to preview images using javascript. Obv...
No comments:
Post a Comment