IOComponent.csusing System;
using System.Text;
using System.IO;
using System.ComponentModel;namespace ClassLibrary2
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public class IOComponent:Component
{
StreamReader myStreamReader;
public void DoRead()
{
string strReadFile;
Console.WriteLine("请输入欲读取的文件名称");
strReadFile=Console.ReadLine();
myStreamReader=new StreamReader(strReadFile);
Console.WriteLine("开始读取文件");
     ReadText();
}
private void ReadText()
{
string strBufferText;
do

                          strBufferText=myStreamReader.ReadLine();
  Console.WriteLine(strBufferText);
}while(strBufferText!=null);
}
protected override void Dispose(bool pDis)
{
if(pDis==true)
{
Console.WriteLine("此时传入的参数为true");
Console.WriteLine("关闭数据流对象");
myStreamReader.Close();
}
else
{
Console.WriteLine("此时传入的参数为false");
Console.WriteLine("清楚未受管理的代码");
}
base.Dispose (pDis);
}
~IOComponent()
{
Console.WriteLine("析构函数被调用");
Console.WriteLine("调用Dispose(false)");
        Dispose(false);
Console.ReadLine();
}
public IOComponent()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
}
}
UsingIOComponent.csusing System; 
class UsingIOComponent 
{
public static void Main(string[] args) 
{
          IOComponent myIOComponent=new IOComponent();
  myIOComponent.DoRead();
   myIOComponent.Dispose();
Console.ReadLine();
}
}我的问题如下 1:如何把IOComponent.cs文件编译成为dll文件 被UsingIOComponent.cs引用 在vs2003应该如何作?
 
 2: protected override void Dispose(bool pDis)
{
if(pDis==true)
{
Console.WriteLine("此时传入的参数为true");
Console.WriteLine("关闭数据流对象");
myStreamReader.Close();
}
else
{
Console.WriteLine("此时传入的参数为false");
Console.WriteLine("清楚未受管理的代码");
}
base.Dispose (pDis);
}
~IOComponent()
{
Console.WriteLine("析构函数被调用");
Console.WriteLine("调用Dispose(false)");
        Dispose(false);
Console.ReadLine();
}
   
         既然  Dispose方法可以 释放资源 为什么还要用 ~IOComponent() 这个类的析构函数?
3:pDis==true 和 pDis==false 执行释放资源的操作有什么区别吗