摘要:List測試
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
namespace List測試
{
public struct FileRecord
{
public string Col1;
public string col2;
public string col3;
}
public class MyFile : List
{
public void LoadFromFile(string FilePath)
{
if (System.IO.File.Exists(FilePath))
{
string line;
StreamWriter sw = new StreamWriter(@"E:\Alvin\tmp\a.txt");
using (StreamReader sr = new StreamReader(FilePath))
{
while ((line = sr.ReadLine()) != null)
{
sw.WriteLine(line);
}
}
sw.Close();
}
}
}
///
/// MainWindow.xaml 的互動邏輯
///
public partial class MainWindow : Window
{
MyFile f;
public MainWindow()
{
InitializeComponent();
f=new MyFile();
f.LoadFromFile(@"E:\Alvin\tmp\bbb.txt");
}
}
}