</pre><pre name="code" class="csharp">using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 源代码计算
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public String FileName
{
get;
set;
}
private void btnOpen_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
FileName = openFileDialog1.FileName;
CoutLine.countLine(FileName);
textBox1.Text = CoutLine.allLine.ToString();
textBox2.Text = CoutLine.codeLine.ToString();
textBox3.Text = CoutLine.commentaryLine.ToString();
}
}
}
}
CoutLine 类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace 源代码计算
{
class