DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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, 11:19 AM
  2. active-x component can't create object
    By shachar in forum VB Classic
    Replies: 1
    Last Post: 03-31-2001, 01:02 AM
  3. Automation server can't create object
    By Mary in forum Architecture and Design
    Replies: 0
    Last Post: 12-08-2000, 12: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, 02:48 PM
  5. ActiveX component can't create object
    By Steven King in forum VB Classic
    Replies: 7
    Last Post: 04-19-2000, 12:05 PM

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links