Click here to Skip to main content
15,900,643 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: WPF/Graphic framework for a table Pin
Richard MacCutchan27-Oct-10 11:30
mveRichard MacCutchan27-Oct-10 11:30 
Questionmodal popup extender in page load Pin
Member 387988122-Oct-10 22:48
Member 387988122-Oct-10 22:48 
AnswerRe: modal popup extender in page load Pin
T M Gray27-Oct-10 8:54
T M Gray27-Oct-10 8:54 
QuestionVB.NET Ideas Pin
Herboren22-Oct-10 19:31
Herboren22-Oct-10 19:31 
AnswerRe: VB.NET Ideas Pin
Luc Pattyn23-Oct-10 2:48
sitebuilderLuc Pattyn23-Oct-10 2:48 
GeneralRe: VB.NET Ideas Pin
Herboren23-Oct-10 18:44
Herboren23-Oct-10 18:44 
AnswerRe: VB.NET Ideas Pin
Abhinav S23-Oct-10 19:01
Abhinav S23-Oct-10 19:01 
Questionserialization Pin
lukeer21-Oct-10 22:31
lukeer21-Oct-10 22:31 
Hi experts,

imagine a system of connected objects like this one:
public class ClassA
{
    private bool _reversed = false;
}

public class ClassB
{
    private ClassA _objectA1 = new ClassA();
    private ClassA _objectA2 = new ClassA();

    private ClassB _previous = null;
    private ClassB _next = null;
}

public class ClassBContainer:ICollection<ClassB>
{
    private List<ClassB> _innerList = new List<ClassB>();
}

public class Form1:Form
{
    private ClassBContainer _devices = new ClassBContainer();

    private void BtSave_Click(object sender, EventArgs e)
    {
        // Save _devices to disk
    }

    private void BtLoad_Click(object sender, EventArgs e)
    {
        // _devices = Load(filename);
    }
}
What is best practice to serialize/deserialize such an ICollection?

1. I thought of XMLSerializer. Problem here is non-public data. I would have to create public properties for all private data. That seems like rendering the 'private' keyword useless.

I would also have to hide those public properties from other parts of the code.

What happens to two instances of ClassB pointing at each other in their _previous and _next properties, respectively? Will that create an infinite loop during serialization?

XMLSerializer handles Lists nicely and keeps type information in the serialized form.

2. I thought of BinaryFormatter/SoapFormatter. This resulted in an exception saying that some GUI objects were not marked [Serializable] (The GUI seems connected to business objects through some events it has to react on.)

I could control the behaviour by implementing ISerializable:
GetObjectData(SerializationInfo info, StreamingContext context);
and
Constructor(SerializationInfo info, StreamingContext context);
for every class involved. How is that done for Lists?

At least the objects pointing at each other seem no problem for SoapFormatter. They are aliased as "ref-3" (number changes for each object) and references use that alias.


Again, is there a best practice approach to serializing object systems like the one mentioned above?

Ciao,


luker

AnswerRe: serialization Pin
Eddy Vluggen23-Oct-10 4:25
professionalEddy Vluggen23-Oct-10 4:25 
QuestionIs Microsoft.SqlServer.Management the easiest way to go? Pin
giantWoodenBadger21-Oct-10 5:35
giantWoodenBadger21-Oct-10 5:35 
AnswerRe: Is Microsoft.SqlServer.Management the easiest way to go? Pin
Eddy Vluggen23-Oct-10 3:48
professionalEddy Vluggen23-Oct-10 3:48 
GeneralMessage Removed Pin
27-Oct-10 7:37
flflshop27-Oct-10 7:37 
GeneralRe: Is Microsoft.SqlServer.Management the easiest way to go? Pin
Dave Kreskowiak27-Oct-10 7:41
mveDave Kreskowiak27-Oct-10 7:41 
QuestionWhat is Mock Version? Pin
Gobi.madura19-Oct-10 19:41
Gobi.madura19-Oct-10 19:41 
AnswerRe: What is Mock Version? Pin
David Skelly19-Oct-10 22:09
David Skelly19-Oct-10 22:09 
AnswerRe: What is Mock Version? Pin
Abhinav S19-Oct-10 22:17
Abhinav S19-Oct-10 22:17 
AnswerRe: What is Mock Version? Pin
T M Gray21-Oct-10 4:39
T M Gray21-Oct-10 4:39 
QuestionProgramming Problem Pin
rksreadero19-Oct-10 17:11
rksreadero19-Oct-10 17:11 
AnswerRe: Programming Problem Pin
Abhinav S19-Oct-10 22:20
Abhinav S19-Oct-10 22:20 
AnswerRe: Programming Problem Pin
DaveyM6919-Oct-10 22:20
professionalDaveyM6919-Oct-10 22:20 
AnswerRe: Programming Problem Pin
Pete O'Hanlon19-Oct-10 23:43
mvePete O'Hanlon19-Oct-10 23:43 
QuestionRSS reader code problem. Pin
rksreadero19-Oct-10 16:38
rksreadero19-Oct-10 16:38 
QuestionWord c# interop bookmark issue(s) Pin
jboyd11119-Oct-10 9:53
jboyd11119-Oct-10 9:53 
AnswerRe: Word c# interop bookmark issue(s) Pin
Maciej Los19-Oct-10 10:30
mveMaciej Los19-Oct-10 10:30 
QuestionLearning Entity Framework [modified] Pin
Luca Leonardo Scorcia18-Oct-10 9:30
professionalLuca Leonardo Scorcia18-Oct-10 9:30 

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.