public class Inclusion
{
public string ComponentTypeFullName { get; set; }
public string EventName { get; set; }
public string[] SenderPropertyNames { get; set; }
public string[] EventArgsPropertyNames { get; set; }
}
static Listli = new List ()
{
new Inclusion(){
ComponentTypeFullName="Infragistics.Win.Misc.UltraButton",
EventName="Click",
SenderPropertyNames=new string[]{null},
EventArgsPropertyNames=new string[]{null}},
new Inclusion() {
ComponentTypeFullName="Infragistics.Win.UltraWinEditors.UltraComboEditor",
EventName="SelectionChanged",
SenderPropertyNames=new string[]{"Text"},
EventArgsPropertyNames=new string[]{null}},
new Inclusion() {
ComponentTypeFullName="Infragistics.Win.UltraWinToolbars.UltraToolbarsManager",
EventName="ToolClick",
SenderPropertyNames=new string[]{null},
EventArgsPropertyNames=new string[]{"Tool.Key"}},
};
//Read
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(List));
string cd = Settings.Default.Inclusion;
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(cd));
Listli2 =(List ) ser.ReadObject(ms);
ms.Close();
//write to see the format
Type t = li.GetType();
DataContractJsonSerializer ser2 = new DataContractJsonSerializer(t);
FileStream fs = new FileStream(@"c:\3.txt", FileMode.CreateNew);
ser.WriteObject(fs, li);
fs.Flush();
fs.Close();
Monday, November 1, 2010
App Setting Json serialization
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment