求指导
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 Microsoft.Win32;
using
namespace WhileStatement
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private OpenFileDialog openFileDialog = null;
public MainWindow()
{
InitializeComponent();//
openFileDialog = new OpenFileDialog();//
openFileDialog.FileOk += openFileDialogFileOk;//
}
private void openFileClick(object sender, RoutedEventArgs e)
{
openFileDialog.ShowDialog();//
}
private void openFileDialogFileOk(object sender, e)
{
string fullPathname = openFileDialog.FileName;
FileInfo src = new FileInfo(fullPathname);
fileName.Text = src.Name;//打开文件目录获取选中文件
source.Text = "";//打开新文件之前先清空文本框
TextReader reader = src.OpenText();//打开文件
string line = reader.ReadLine();//读取文件中的一行(从第一行开始)
while (line != null)
{
source.Text += line + '\n';
line = reader.ReadLine();//读新的一行 空格照读 直到为空 空格读出来还是空格
}
reader.Close();//关闭文件
}
private void source_TextChanged(object sender, TextChangedEventArgs e)
{
}
}
}
openFileDialog是什么
在帮个忙加个注释 (有//的地方)