RcBuilder@walla.com
call centre: 054-5614020

web config custom section group

Posted by: RcBuilder  /   Category: configuration / Custom section / Serialize / XML   /   No Comments
05
Oct
2014

web config custom section group WEB.CONFIG  <configuration> <configSections> <section name="MTGroups" type="ConfigSections.MTGroups" /> </configSections> <MTGroups> <add name="Name1" value="Value1" /> <add name="Name2" value="Value2" /> <add name="Name3" value="Value3" /> </MTGroups> </configuration> SERIALIZATION  using System.Configuration; namespace ConfigSections { public class MTGroups : ConfigurationSection{ public Group keys { get { return (Group)this; } } } public class Group : ConfigurationElementCollection{ protected override ConfigurationElement CreateNewElement() { return new Key(); } protected override object GetElementKey(ConfigurationElement element) { return ((Key)element).name; } } public class Key : ConfigurationElement{ public string name { get {.

Read more

Binary Formatter

Posted by: RcBuilder  /   Category: bin / BinaryFormatter / Files / FileStream / Serialize / SOURCE CODE / Stream   /   No Comments
05
Oct
2014

Binary Formatter class Binary_Formatter { public void BaseObject(){ string Path = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "test.bin"); string Name = "Roby Cohen"; Console.WriteLine("SERIALIZE " + Name); BinaryFormatter formatter = new BinaryFormatter(); using (FileStream fsWrite = new FileStream(Path, FileMode.Create)) { formatter.Serialize(fsWrite, Name); } Console.WriteLine("DESERIALIZE "); using (FileStream fsRead = new FileStream(Path, System.IO.FileMode.Open)) { string WhatsMyName = (string)formatter.Deserialize(fsRead); Console.WriteLine(WhatsMyName); } } public void CustomObject() { string Path = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "test2.bin"); User user = new User(33, "Shirly Massa", "somewhere over the rainbow"); Console.WriteLine("SERIALIZE USER"); BinaryFormatter formatter.

Read more

custom config section example

Posted by: RcBuilder  /   Category: configuration / Custom section / IEnumerable / Serialize / XML   /   No Comments
01
Oct
2014

custom config section example namespace ConfigSections // this class should define the xml structure of your custom config section in order to get the // ability to deSerialize it public class MTGroups : ConfigurationSection, IEnumerable<MTGroups.Key> { public MTGroups.Group keys { get { return (MTGroups.Group)this; } } public IEnumerator<MTGroups.Key> GetEnumerator() { foreach (MTGroups.Key k in this.keys) yield return k; } IEnumerator IEnumerable.GetEnumerator() { throw new NotImplementedException(); } public class Group : ConfigurationElementCollection { protected.

Read more
  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים