.NET中不可变类型的示例 [英] Examples of Immutable Types in .Net

查看:68
本文介绍了.NET中不可变类型的示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道不变性的概念,但是除了

We know the concept of immutability but need to know few immutable types other than

  • 字符串
  • DateTime

还有更多吗?

推荐答案

以下是框架类库中不可变类型的列表. (随时进行扩展!)

A list of immutable types in the framework class library follows below. (Feel free to expand it!)

  • 所有原始值类型:(注:
  • All primitive value types: (Note: not all value types are immutable!)
    • Byte and SByte
    • Int16 and UInt16
    • Int32 and UInt32
    • Int64 and UInt64
    • IntPtr
    • Single
    • Double
    • Lookup<TKey, TElement>

    这篇关于.NET中不可变类型的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆