Click here to Skip to main content
15,914,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: Saving form or panel as an object Pin
Naveed72721-Jan-09 23:19
Naveed72721-Jan-09 23:19 
GeneralRe: Saving form or panel as an object Pin
Tom Deketelaere21-Jan-09 23:27
professionalTom Deketelaere21-Jan-09 23:27 
GeneralRe: Saving form or panel as an object Pin
Naveed72721-Jan-09 23:35
Naveed72721-Jan-09 23:35 
GeneralRe: Saving form or panel as an object Pin
Tom Deketelaere21-Jan-09 23:59
professionalTom Deketelaere21-Jan-09 23:59 
GeneralRe: Saving form or panel as an object Pin
DaveyM6921-Jan-09 23:48
professionalDaveyM6921-Jan-09 23:48 
GeneralRe: Saving form or panel as an object Pin
Naveed72722-Jan-09 0:13
Naveed72722-Jan-09 0:13 
GeneralRe: Saving form or panel as an object Pin
DaveyM6922-Jan-09 0:40
professionalDaveyM6922-Jan-09 0:40 
AnswerRe: Saving form or panel as an object [modified] Pin
moon_stick22-Jan-09 0:11
moon_stick22-Jan-09 0:11 
I've not tested it but you might be able to modify the following code; this basically does a deep copy of an object using serialization. Some minor modifications should allow to to write to a FileStream rather than a MemoryStream and then you'd extrapolate two functions (get and set).

<br />
    public static T DeepCopy<t>(T obj)<br />
    {<br />
        object result = null;<br />
<br />
        using (var ms = new MemoryStream())<br />
        {<br />
            var formatter = new BinaryFormatter();<br />
            formatter.Serialize(ms, obj);<br />
            ms.Position = 0;<br />
<br />
            result = (T)formatter.Deserialize(ms);<br />
            ms.Close();<br />
        }<br />
<br />
        return (T)result;<br />
    }<br />
<br />
</t>


I haven't got time to work through the solution fully so I've left it as an exercise for you.

It definitely isn't definatley

modified on Thursday, January 22, 2009 6:18 AM

GeneralRe: Saving form or panel as an object Pin
Naveed72722-Jan-09 1:20
Naveed72722-Jan-09 1:20 
QuestionHow to avoid stack overflow ? Pin
Spunky Coder21-Jan-09 22:13
Spunky Coder21-Jan-09 22:13 
AnswerRe: How to avoid stack overflow ? Pin
Pete O'Hanlon21-Jan-09 22:40
mvePete O'Hanlon21-Jan-09 22:40 
AnswerRe: How to avoid stack overflow ? Pin
#realJSOP22-Jan-09 0:14
professional#realJSOP22-Jan-09 0:14 
GeneralRe: How to avoid stack overflow ? Pin
S. Senthil Kumar22-Jan-09 3:05
S. Senthil Kumar22-Jan-09 3:05 
AnswerRe: How to avoid stack overflow ? Pin
Guffa22-Jan-09 0:35
Guffa22-Jan-09 0:35 
GeneralRe: How to avoid stack overflow ? Pin
Spunky Coder26-Jan-09 22:34
Spunky Coder26-Jan-09 22:34 
GeneralRe: How to avoid stack overflow ? Pin
Guffa27-Jan-09 1:22
Guffa27-Jan-09 1:22 
AnswerRe: How to avoid stack overflow ? Pin
Ben Fair22-Jan-09 4:43
Ben Fair22-Jan-09 4:43 
GeneralRe: How to avoid stack overflow ? Pin
Spunky Coder26-Jan-09 23:05
Spunky Coder26-Jan-09 23:05 
GeneralRe: How to avoid stack overflow ? Pin
Guffa27-Jan-09 1:27
Guffa27-Jan-09 1:27 
GeneralRe: How to avoid stack overflow ? Pin
Ben Fair27-Jan-09 4:11
Ben Fair27-Jan-09 4:11 
QuestionSave Listview data to SQL database Pin
Tuntgerhuu21-Jan-09 22:06
Tuntgerhuu21-Jan-09 22:06 
AnswerRe: Save Listview data to SQL database Pin
CPallini21-Jan-09 23:22
mveCPallini21-Jan-09 23:22 
QuestionWCF Client is not Receving Response Pin
Member 587250021-Jan-09 21:54
Member 587250021-Jan-09 21:54 
QuestionTest string for DBnull as opposed to null? Pin
kanchoette21-Jan-09 21:32
kanchoette21-Jan-09 21:32 
AnswerRe: Test string for DBnull as opposed to null? Pin
SeMartens21-Jan-09 21:34
SeMartens21-Jan-09 21:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.