2.4.4.cs
/*
作者:frank
时间:2017年7月18日11:53:19
*/
using System;
namespace Sample
{
public class Program
{
public static void Main()
{
/*
object、string类型
所有类型都间接或者直接继承object
*/
object oInt = 9;
object oBool = false;
object oChar = '\x0041';
object oFloat = 0.05F;
Console.WriteLine("oInt:" + oInt.GetType());
Console.WriteLine("oBool:" + oBool.GetType());
Console.WriteLine("oChar:" + oChar.GetType());
Console.WriteLine("oFloat:" + oFloat.GetType());
string s1 = "a string";//可以赋值Unicode和十六进制的值
string s2 = s1;
Console.WriteLine("s1 is:" + s1);
Console.WriteLine("s2 is:" + s2);
s1 = "another string";//string做了运算符重载,重新赋值就会开辟新的内存空间进行存储后返回新的引用地址,而不是在原来的内存中进行修改。
Console.WriteLine("s1 is now " + s1);
Console.WriteLine("s2 is now " + s2);
string filePath = "C:\\ProCSHarp\\First.cs";
string filePath2 = @"C:\ProCSharp\First.cs";
string jabberwocky = @"'Twas brillig and the slithy toves
Did gyre and gimble in the wabe.";
Console.WriteLine(filePath);
Console.WriteLine(filePath2);
Console.WriteLine(jabberwocky);
}
}
}