本文整理汇总了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));
}
示例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));
}
示例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();
}
示例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());
}
示例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());
}