byte[] bys=buffer;

string[] AllDataList=  Encoding.Default.GetString(bys).Split(Environment.NewLine.ToCharArray());

Encoding.Default.GetString(bys) 表示byte[]转成string。

Split(Environment.NewLine.ToCharArray());  表示按照换行符进行split成string数组。

------------------------------------------------------------------------------------

protected override void Execute(CodeActivityContext context)
        {
            byte[] buffer = context.GetValue(inBuffer);
            Encoding encod = context.GetValue(inEncoding);
            List<string> list = new List<string>();
            
            using (MemoryStream ms = new MemoryStream(buffer))
            {                

                using (StreamReader sr = new StreamReader(ms, encod))
                {
                    while (sr.Peek() != -1)
                    {
                        list.Add(sr.ReadLine());
                    }
                }
            }

            context.SetValue(outListField, list);
        }

05-11 11:17