说什么
int a = int.Parse("100");
是否有任何箱子/箱子或车内投放的类型?
说什么
int a = int.Parse("100");
是否有任何箱子/箱子或车内投放的类型?
没有箱子或箱子。 为什么要问? 平价算法比箱/箱式操作成本要高得多,因此,即使有差异,你也会把“纤维”推向业绩差异。
是的,使用Reflector,你可以确切看到什么进展。 我看不到任何箱子,但有一些 cast子,例如:
private static unsafe void StringToNumber(string str, NumberStyles options, ref NumberBuffer number, NumberFormatInfo info, bool parseDecimal)
{
if (str == null)
{
throw new ArgumentNullException("String");
}
fixed (char* str2 = ((char*) str))
{
char* chPtr = str2;
char* chPtr2 = chPtr;
if (!ParseNumber(ref chPtr2, options, ref number, info, parseDecimal) ||
((((long) ((chPtr2 - chPtr) / 2)) < str.Length) && //cast
!TrailingZeros(str, (int) ((long) ((chPtr2 - chPtr) / 2))))) //cast
{
throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
}
}
}
或者,这种情况发生于:
private static unsafe char* MatchChars(char* p, string str)
{
fixed (char* str2 = ((char*) str)) //cast
{
char* chPtr = str2;
return MatchChars(p, chPtr);
}
}
真正的问题是:
添加我的意思。
The term/technique of "Unboxing" is ONLY relevant for a boxed value type. Thus, if a value type variable is not boxed(converted to reference type), it can be unboxed.
在你看来,你具有有效的参考类型价值,但范围不容置疑。