本文整理汇总了C#中Employee.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Employee.ToString方法的具体用法?C# Employee.ToString怎么用?C# Employee.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Employee tom = new Employee("Tom", "123 NW Street", "Des Moines", "Iowa", "50000");
Console.WriteLine(tom.ToString());
tom.Insurance = new InsuranceInfo() { policyid="1", policyname="Policy Name" };
Console.WriteLine(tom.ToString());
Console.ReadLine();
}
示例2: Main
/// <summary>
/// Based on the article "Priority Queues with C#" by James McCaffrey:
/// http://visualstudiomagazine.com/articles/2012/11/01/priority-queues-with-c.aspx
/// </summary>
private static void Main()
{
Console.WriteLine("\nBegin Priority Queue demo");
Console.WriteLine("\nCreating priority queue of Employee items\n");
PriorityQueue<Employee> queue = new PriorityQueue<Employee>();
Employee e1 = new Employee("Aiden", 1.0);
Employee e2 = new Employee("Baker", 2.0);
Employee e3 = new Employee("Chung", 3.0);
Employee e4 = new Employee("Dunne", 4.0);
Employee e5 = new Employee("Eason", 5.0);
Employee e6 = new Employee("Flynn", 6.0);
Console.WriteLine("Adding " + e5.ToString() + " to priority queue");
queue.Enqueue(e5);
Console.WriteLine("Adding " + e3.ToString() + " to priority queue");
queue.Enqueue(e3);
Console.WriteLine("Adding " + e6.ToString() + " to priority queue");
queue.Enqueue(e6);
Console.WriteLine("Adding " + e4.ToString() + " to priority queue");
queue.Enqueue(e4);
Console.WriteLine("Adding " + e1.ToString() + " to priority queue");
queue.Enqueue(e1);
Console.WriteLine("Adding " + e2.ToString() + " to priority queue");
queue.Enqueue(e2);
Console.WriteLine("\nPriory queue is: ");
Console.WriteLine(queue.ToString());
Console.WriteLine("\n");
Console.WriteLine("Removing an employee from priority queue");
Employee e = queue.Dequeue();
Console.WriteLine("Removed employee is " + e.ToString());
Console.WriteLine("\nPriory queue is now: ");
Console.WriteLine(queue.ToString());
Console.WriteLine("\n");
Console.WriteLine("Removing a second employee from queue");
e = queue.Dequeue();
Console.WriteLine("\nPriory queue is now: ");
Console.WriteLine(queue.ToString());
Console.WriteLine("\n");
}
示例3: ToStringShouldReturnFullName
public void ToStringShouldReturnFullName()
{
var employee = new Employee("", "Joe", "Camel", "");
Assert.That(employee.ToString(), Is.EqualTo("Joe Camel"));
}
示例4: TestToString
public void TestToString() {
_employee = new Employee{ Name = "a" };
Assert.AreEqual( string.Format( "Id:{0},姓名:a", _employee.Id ), _employee.ToString() );
}