using System; [Serializable] public sealed class MailReceivedEventArgs : EventArgs { private readonly string from; private readonly string subject; public MailReceivedEventArgs(string from, string subject) { this.from = from; this.subject = subject; } public string From { get { return from; } } public string Subject { get { return subject; } } } public class MainClass { public static void Main() { MailReceivedEventArgs args = new MailReceivedEventArgs("D", "Y"); Console.WriteLine("From: {0}, Subject: {1}", args.From, args.Subject); } }
Author: coder
Is 2003 Vista Or Greater
using System; using System.Collections.Generic; using System.Linq; using System.Text; internal class OSHelper { internal static bool Is2003VistaOrGreater { get { return Environment.OSVersion.Version.CompareTo(new Version(5, 2)) >= 0; } } internal static bool IsVistaOrGreater { get { return Environment.OSVersion.Version.CompareTo(new Version(6, 0)) >= 0; } } }
Environment.SystemDirectory
using System; class MainClass { public static void Main() { Console.WriteLine("System folder : " + Environment.SystemDirectory); } }
Environment.CurrentDirectory
using System; class MainClass { public static void Main() { Console.WriteLine("Current folder : " + Environment.CurrentDirectory); } }
Environment.GetLogicalDrives
using System; class MainClass { public static void Main() { foreach (string s in Environment.GetLogicalDrives()) { Console.WriteLine("Logical drive : " + s); } } }
Environment.TickCount
using System; class MainClass { public static void Main() { Console.WriteLine("Ticks since startup : " + Environment.TickCount); } }
Environment.HasShutdownStarted
using System; class MainClass { public static void Main() { Console.WriteLine("Shutting down? : " + Environment.HasShutdownStarted); } }