RcBuilder@walla.com
call centre: 054-5614020

WebClient download string

Posted by: RcBuilder  /   Category: FileStream / HttpRequest / SOURCE CODE / Stream / WebClient / WebRequest   /   No Comments
25
Nov
2014

WebClient download string get Http content using WebClient option 1 var json = new WebClient().DownloadString(url); option 2 string url = "......" var request = HttpWebRequest.Create(url); var response = request.GetResponse(); var reader = new StreamReader(response.GetResponseStream()); string jsonText = reader.ReadToEnd(); remark: don't forget to use the 'using'.

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
  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים