1、learn to write a c# console program to list all directories and files in a hard drive.2、learn to write a program to read binary/UTF8 files and write a binary/UTF8 file.3、learn to read and write a xml file using c# write a program to read the attached
XML file using XML class(XmlDocument or any others you like) and change all <item>
"displayName" attributes to the "original name"+"中国" and remove <Target> element
and then save it to a new XML file.XML file
- <Destination>
- <Target type="destinarion">
  <SPS target="SpS" wirtualServer="http://tiger/" /> 
  </Target>
- <Items>
  <Item displayName="http://tiger/sites/portalavetest" hasSubFolders="true" hasSubItems="false" id="69bddb0c-7c9b-8704-d6514cfc8978" restoreOption="0" type="100" /> 
  <Item displayName="." hasSubFolders="true" hasSubItems="true" id="d2e13043-sf46-42-a7b8-0f7dfb544756" restoreOption="0" type="200" /> 
  <Item displayName="Tasks" hasSubFolders="true" hasSubItems="true" id="54122b59-3137-47e5-bc5b-ddof91025b66" restoreOption="0" subid="107" type="200" /> 
  </Items>
  </Destination>
4、write a c# program to take the database(SQL server 2000) connecting string as the input 
and list all the user tables and the first row of each tables in the database.

解决方案 »

  1.   

    1、MSDN上有源代码
    2、MSDN上有源代码
    3、MSDN上有源代码
    4、MSDN上有类似代码唉
      

  2.   

    Yes! That's all right!
     Pay more attention to the basic knowledge first!
      

  3.   

    1.
    using System;
    using System.IO;
    namespace hdprg
    {
    /// <summary>
    /// Class1 的摘要描述。
    /// </summary>
    class HDPRG
    {
    protected static int i=0;
    protected static int j=0;
    /// <summary>
    /// 應用程式的主進入點。
    /// </summary>
    [STAThread]
    static void Main(string[] args)
    {
    //
    // TODO: 在此加入啟動應用程式的程式碼
    //
    DirectoryList();
    }

    protected static void DirectoryList()
    {
    string strRootDirectory=string.Empty;

    strRootDirectory=System.Environment.CurrentDirectory;
    DirectoryInfo obj_Parent=new DirectoryInfo(strRootDirectory);
    DirectoryList(obj_Parent);

    Console.Write("Directory Number is{0};File Numbers is {1}",j,i);
    }
    protected static void DirectoryList(DirectoryInfo obj_DirectInfo)
    {
    DirectoryInfo[] obj_Child=obj_DirectInfo.GetDirectories();
    FileInfo[] obj_Files=obj_DirectInfo.GetFiles();
    foreach(DirectoryInfo obj_t in obj_Child)
    {
    Console.Write(obj_t.Name+"\n");
    DirectoryList(obj_t);
    j++;
    }
    foreach(FileInfo  obj_File in obj_Files)
    {
    Console.Write(" "+obj_File.Name+"\n");
     i++;
    } }
    } }