how to create an copy of an object


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: how to create an copy of an object

  1. #1
    Join Date
    Mar 2007
    Posts
    5

    how to create an copy of an object

    I am using c#.net(2005)
    The problem with the assignment like is,

    Object obj=new object();

    Obj=this; (current class)



    Reflection (i.e) if we change in the Copied object the pasted object is changing according to the change made.



    Can you please help me in this.

  2. #2
    Join Date
    Dec 2004
    Posts
    163
    Nanda1605,

    For "simple" objects whose properties are value types, create a Clone method for the object that uses MemberwiseClone to make a shallow copy.

    For objects with properties that are reference types, implement the ICloneable interface.

    Kerry Moorman

Similar Threads

  1. Automation server can't Create object
    By Teeroo in forum .NET
    Replies: 2
    Last Post: 06-11-2006, 12:19 PM
  2. active-x component can't create object
    By shachar in forum VB Classic
    Replies: 1
    Last Post: 03-31-2001, 02:02 AM
  3. Automation server can't create object
    By Mary in forum Architecture and Design
    Replies: 0
    Last Post: 12-08-2000, 01:37 PM
  4. How do you create a file system object in vb srcipt or vb 6.0
    By Michael Kascher in forum VB Classic
    Replies: 2
    Last Post: 05-31-2000, 03:48 PM
  5. ActiveX component can't create object
    By Steven King in forum VB Classic
    Replies: 7
    Last Post: 04-19-2000, 01:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center