当前位置: 首页>>代码示例>>C#>>正文


C# Employee.ToString方法代码示例

本文整理汇总了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();
 }
开发者ID:jasonweibel,项目名称:TrainingMaterial,代码行数:8,代码来源:Program.cs

示例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");
    }
开发者ID:VesiBaleva,项目名称:TelerikAcademy,代码行数:48,代码来源:PriorityQueueDemo.cs

示例3: ToStringShouldReturnFullName

 public void ToStringShouldReturnFullName()
 {
     var employee = new Employee("", "Joe", "Camel", "");
     Assert.That(employee.ToString(), Is.EqualTo("Joe Camel"));
 }
开发者ID:rajendra1809,项目名称:ClearMeasureBootcamp,代码行数:5,代码来源:EmployeeTester.cs

示例4: TestToString

 public void TestToString() {
     _employee = new Employee{ Name = "a" };
     Assert.AreEqual( string.Format( "Id:{0},姓名:a", _employee.Id ), _employee.ToString() );
 }
开发者ID:NetUtil,项目名称:Util,代码行数:4,代码来源:GuidEntityBaseTest.cs


注:本文中的Employee.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。