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


C# Car.ToString方法代码示例

本文整理汇总了C#中Car.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Car.ToString方法的具体用法?C# Car.ToString怎么用?C# Car.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Car的用法示例。


在下文中一共展示了Car.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetGCInfo

    static void GetGCInfo()
    {
        Console.WriteLine("Estimated bytes on the heap: {0}", GC.GetTotalMemory(false));
        Console.WriteLine("This OS has {0} object generations", GC.MaxGeneration+1);

        Car refToMyCar = new Car();
        Console.WriteLine(refToMyCar.ToString());
        Console.WriteLine("Generation of refToMyCar is: {0}",
                GC.GetGeneration(refToMyCar));

        GC.Collect(0);
        GC.WaitForPendingFinalizers();
        Console.WriteLine("Generation of refToMyCar is: {0}",
                GC.GetGeneration(refToMyCar));
    }
开发者ID:walrus7521,项目名称:code,代码行数:15,代码来源:GarbageCollect.cs

示例2: Main

    static void Main(string[] args)
    {
        Console.WriteLine("***** Fun with System.GC *****");

        // Print out estimated number of bytes on heap.
        Console.WriteLine("Estimated bytes on heap: {0}", GC.GetTotalMemory(false));

        // MaxGeneration is zero based.
        Console.WriteLine("This OS has {0} object generations.\n", (GC.MaxGeneration + 1));
        Car refToMyCar = new Car("Zippy", 100);
        Console.WriteLine(refToMyCar.ToString());

        // Print out generation of refToMyCar.
        Console.WriteLine("\nGeneration of refToMyCar is: {0}", GC.GetGeneration(refToMyCar));

        // Make a ton of objects for testing purposes.
        object[] tonsOfObjects = new object[50000];
        for (int i = 0; i < 50000; i++)
            tonsOfObjects[i] = new object();

        // Collect only gen 0 objects.
        GC.Collect(0, GCCollectionMode.Forced);
        GC.WaitForPendingFinalizers();

        // Print out generation of refToMyCar.
        Console.WriteLine("Generation of refToMyCar is: {0}",
        GC.GetGeneration(refToMyCar));

        // See if tonsOfObjects[9000] is still alive.
        if (tonsOfObjects[9000] != null)
        {
            Console.WriteLine("Generation of tonsOfObjects[9000] is: {0}",
            GC.GetGeneration(tonsOfObjects[9000]));
        }
        else
            Console.WriteLine("tonsOfObjects[9000] is no longer alive.");

        // Print out how many times a generation has been swept.
        Console.WriteLine("\nGen 0 has been swept {0} times",
        GC.CollectionCount(0));
        Console.WriteLine("Gen 1 has been swept {0} times",
        GC.CollectionCount(1));
        Console.WriteLine("Gen 2 has been swept {0} times",
        GC.CollectionCount(2));
    }
开发者ID:sssllliang,项目名称:drills,代码行数:45,代码来源:garbage_collection.cs

示例3: GetCar

        public void GetCar(string clientId, string carId)
        {
            selectedClient = this.SelectClient(clientId);
            selectedCar =  this.SelectCar(carId);

            this.ResetCarStatus();
            if (selectedCar != null & selectedClient != null)
            {
                if (this.CarIsFree(selectedCar))
                {
                    selectedCar.Client = selectedClient.Id;
                    selectedCar.DateOfLease = DateTime.Now.ToString();
                    _carRepository.Save(selectedCar);
                    Console.WriteLine(selectedCar.ToString());
                }
                else
                {
                    Console.WriteLine("This car is used.");
                }
            }

            ResetSelected();
        }
开发者ID:WilliamRobertMontgomery,项目名称:asp-dot-net-training-project,代码行数:23,代码来源:CarRentalSystem.cs

示例4: C_Info_ModifyCar

 //�޸ij�����Ϣ
 public static void C_Info_ModifyCar(Car car)
 {
     StringBuilder stb = new StringBuilder(Constant.HEAD).Append(Constant.C_INFO);
     stb.Append(Constant.C_INFO_CAR_MOD).Append(car.ToString()).Append(Constant.FOOT);
     dataSocket.Send(stb.ToString());
 }
开发者ID:suwadee2015,项目名称:GPS,代码行数:7,代码来源:FormMain.Socket.cs

示例5: C_Info_AddCar

 //��ӳ���
 public static void C_Info_AddCar(Car car)
 {
     car.CarID = 0;
     StringBuilder stb = new StringBuilder(Constant.HEAD).Append(Constant.C_INFO);
     stb.Append(Constant.C_INFO_CAR_ADD).Append(car.Team.TeamID).Append(Constant.SPLIT1).Append(car.ToString()).Append(Constant.FOOT);
     dataSocket.Send(stb.ToString());
 }
开发者ID:suwadee2015,项目名称:GPS,代码行数:8,代码来源:FormMain.Socket.cs


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