یاسردرا
Member
سلام.
دوستان دلیل این که ArrayList ام Serializeنمیشه چیه؟؟؟؟
چگونه مشکلمو حل کنم؟؟؟؟؟؟
ممنون میشم.
دوستان دلیل این که ArrayList ام Serializeنمیشه چیه؟؟؟؟
چگونه مشکلمو حل کنم؟؟؟؟؟؟
ممنون میشم.
کد:
public ArrayList a=new ArrayList();
public Class1 cc;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
List<Class1> c = new List<Class1>();
a.Add(c);
cc = new Class1();
cc.name = "yaser";
cc.lastname = "dara";
((List<Class1>)a[0]).Add(cc);
using (System.IO.Stream s = System.IO.File.Open(AppDomain.CurrentDomain.BaseDirectory + "as.sic", System.IO.FileMode.OpenOrCreate))
{
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(s, a);
}
}
کد:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication2
{
public class Class1
{
public string name { get; set; }
public string lastname { get; set; }
}
}