gpt4 book ai didi

c# - Box 和 Unbox 是什么意思?

转载 作者:可可西里 更新时间:2023-11-01 08:34:07 25 4
gpt4 key购买 nike

<分区>

Possible Duplicates:
Why do we need boxing and unboxing in C#?
What is boxing and unboxing and what are the trade offs?

在 C# 中,“装箱和拆箱”是什么意思?

这是我在其中找到文本的 MSDN 的摘录。

But this convenience comes at a cost.Any reference or value type that isadded to an ArrayList is implicitlyupcast to Object. If the items arevalue types, they must be boxed whenthey are added to the list, andunboxed when they are retrieved. Boththe casting and the boxing andunboxing operations decreaseperformance; the effect of boxing andunboxing can be very significant inscenarios where you must iterate overlarge collections.

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com