using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)//静态方法,不需对象即可调用
{
Test1 testOne=new Test1();
Test2 testTwo = new Test2();
testTwo.test2(testOne);
testOne.outPut();
ConsoleApplication2.subConsoleApplication2.Product a = new ConsoleApplication2.subConsoleApplication2.Product();
Console.ReadLine();
}
}
class Test1
{
int testInt;
public Test1()//若构造函数位私有,则无法定义变量。因为外部无法调用构造函数。只能通过static函数调用
{
testInt = 10;
}
internal void outPut()
{
Console.WriteLine("testInt is " + testInt);
// Console.右键可查看其定义,是个静态类,可调用其静态方法
}
}
class Test2
{
int testInt;
internal void test2(Test1 testParam)
{
testParam.outPut();
}
internal void testThis(int testIntPara)
{
this.testInt = testIntPara;
}
}
class Test3
{
private void messageShow()
{
int testInt = 200;
Console.WriteLine(testInt.ToString());
}
}
public interface theFace
{
void output();
}
public interface otherFace
{
void output2();
}
public class Test4:theFace,otherFace
{
public void output()
{
Console.WriteLine("face1");
}
public void output2()
{
Console.WriteLine("face2");
}
}
}
namespace ConsoleApplication2
{
namespace subConsoleApplication2
{
public class Product
{
static void outPut()
{
Console.WriteLine("face2");
}
}
}
}
test.txt已经存在下的读写
子目录的遍历
子目录与目录下文件的遍历
文件夹移动、父目录、根目录显示
列出c: D: E:..等盘符,{0}表示第一个参数
foreach:集合中元素的遍历
文件的创建、拷贝、删除