哪一种是.net中速度更快的数据类型,还是c#中的数据类型呢? [英] which one is faster data types in .net or data types in c#?
本文介绍了哪一种是.net中速度更快的数据类型,还是c#中的数据类型呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
首先,您好,我很抱歉,因为我的母语不是英语我想了解哪种是更快的C#数据类型或.net数据类型我试图通过下面的代码理解,我认为.net数据类型更快(这是正确的吗?)我在x86和x64平台上都测试了这段代码
Hi to all first of all i am sorry because my first language is not english I want understand which one is faster C# data types or .net data types i try to understand by below code and i think .net data types is faster(is this correct?) i test this code both with x86 and x64 platform
SW.Start();
for (Int32 i = 0; i < 99999; i++)
{
for (Int32 j = 0; j < 999; j++)
{
Int32 a = 37;
Int32 b = 37;
Double c = Math.Pow(a, b);
String d = "abcde";
String e = "abcde";
String f = d + e;
}
}
Console.WriteLine(SW.Elapsed.TotalMilliseconds);
SW.Stop();
Console.ReadKey();
和我的第二个代码
Stopwatch SW = new Stopwatch();
SW.Start();
for (int i = 0; i < 99999; i++)
{
for (int j = 0; j < 999; j++)
{
int a = 37;
int b = 37;
double c = Math.Pow(a, b);
string d = "abcde";
string e = "abcde";
string f = d + e;
}
}
Console.WriteLine(SW.Elapsed.TotalMilliseconds);
SW.Stop();
Console.ReadKey();
非常感谢
推荐答案
int
是 Int32
的别名. Int64
的 long
.
这篇关于哪一种是.net中速度更快的数据类型,还是c#中的数据类型呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文