| 以下为引用的内容: OperatingSystem os = Environment.OSVersion; MessageBox.Show(os.Version.ToString()); MessageBox.Show(os.Platform.ToString()); |
| 以下为引用的内容: public sealed class DriveInfo { [DllImport("kernel32.dll", EntryPoint = "GetDiskFreeSpaceExA")] private static extern long GetDiskFreeSpaceEx(string lpDirectoryName, out long lpFreeBytesAvailableToCaller, out long lpTotalNumberOfBytes, out long lpTotalNumberOfFreeBytes); public static long GetInfo(string drive, out long available, out long total, out long free) { return GetDiskFreeSpaceEx(drive, out available, out total, out free); } public static DriveInfoSystem GetInfo(string drive) { long result, available, total, free; result = GetDiskFreeSpaceEx(drive, out available, out total, out free); return new DriveInfoSystem(drive, result, available, total, free); } } public struct DriveInfoSystem { public readonly string Drive; public readonly long Result; public readonly long Available; public readonly long Total; public readonly long Free; public DriveInfoSystem(string drive, long result, long available, long total, long free) { this.Drive = drive; this.Result = result; this.Available = available; this.Total = total; this.Free = free; } } |
| 以下为引用的内容: string strParent = "The Codeproject site is very informative."; string strChild = "codeproject"; // The line below will return -1 when expected is 4. int i = strParent.IndexOf(strChild); // The line below will return proper index int j = strParent.ToLower().IndexOf(strChild.ToLower()); |
| 以下为引用的内容: using System.Globalization; string strParent = "The Codeproject site is very informative."; string strChild = "codeproject"; // We create a object of CompareInfo class for a neutral culture or a culture insensitive object CompareInfo Compare = CultureInfo.InvariantCulture.CompareInfo; int i = Compare.IndexOf(strParent,strChild,CompareOptions.IgnoreCase); |
| 以下为引用的内容: http://www.knowsky.com/ public Student(Student student) { this.name = student.name; } |
| 以下为引用的内容: class Student { private string name; public Student(string name) { this.name = name; } public Student(Student student) { this.name = student.name; } public string Name { get { return name; } set { name = value; } } } class Final { static void Main() { Student student = new Student ("A"); Student NewStudent = new Student (student); student.Name = "B"; System.Console.WriteLine("The new student's name is {0}", NewStudent.Name); } } The new student's name is A. |
| 以下为引用的内容: class Numbers { public readonly int m; public static readonly int n; public Numbers (int x) { m=x; } static Numbers () { n=100; } } |
| 以下为引用的内容: <a href=”mailto:email@address1.com,email@address2.com?cc=email@address3.com&Subject=Hello&body=Happy New Year”>some text</a> |
| 以下为引用的内容: Process process = new Process(); process.StartInfo.FileName = "mailto:email@address1.com,email@address2.com?subject=Hello&cc=email@address3.com &bcc=email@address4.com&body=Happy New Year" ; process.Start(); |