Click here to Skip to main content
15,897,291 members

stuck with class structure in windows 8 app development. Help ASAP!

Prateek Kumar Pradeep Srivastava asked:

Open original thread
Hi,
Required: I want an xml file to be searialized like this

XML
<StudentGroupList>
   <Group key = 1>
      <StudentItem>
           <Name> John </Name>
           <GroupName>1</GroupName>
      <StudentItem>
      <StudentItem>
           <Name> David</Name>
           <GroupName>1</GroupName>
      <StudentItem>
   </Group>
   <Group key = 2>
      <StudentItem>
           <Name> Ron</Name>
           <GroupName>2</GroupName>
      <StudentItem>
   </Group>
 </StudentGroupList>


Here is the class structure i created to serialize and desreialize

public class StudentItem
{
   public string Name {get; set;}
   public  int GroupName {get; set;}
}

public class StudentGroupList
{
   public List<StudentItem> lstStudnetItem = new List<StudentItem>(){get;set;}
   int key {get;set;}
}
public class StudentDataSource
{
       public List<StudentGroupList> lstStudnetGroup = new List<StudentGroupList>()   {get;set;}
      //Confusion in below line
      public static StudentDataSource objDataSource = new  StudentDataSource();
}


i have created single instance of StudentDataSource so that i can use it globally on every page of my windwos 8 aap. i want to use single instance because this instance will desrialize from the xml file above and simultaneously update it as soon as any changes are made. Now as u see i have made this instance as static i can't access the "lstStudnetGroup".
Please provide me a solution of class structure so that i can easily create an aap.


Quote:
please forgive my representation, its the first time i am writing on any blog for help.
Tags: Deserialization

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900