是Guid是原始类型还是复杂类型? [英] Is a Guid a primitive type or a complex type?

查看:242
本文介绍了是Guid是原始类型还是复杂类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们通过原始类型和我们要扩展的复杂类型来分离扩展方法类。我的问题很简单。将Guid与字符串,int,DateTime等一起被认为是原始类型?

We separate out extension method classes by primitive types and complex types that we are extending. My question is simple. Would a Guid be considered a primitive type along with string, int, DateTime, etc? Or would it be considered a complex type when describing it?

在回顾我的答案后,我非常欣赏澄清,我能够从一些答案收集。

After reviewing the answers I much appreciate the clarification that I was able to glean from some answers. However, I am getting the impression that curiosity killed the cat got the cat murdered, so I am voting to close my own question.

推荐答案

这取决于你所谓的原始数据类型。

It depends on what you call a "primitive data type".

维基百科列出了这两个定义:


  • 基本类型是数据类型由作为基本构建块的编程语言提供。大多数语言允许从基本类型开始递归构造更复杂的复合类型。

  • 内置类型是编程语言提供内置支持的数据类型。

根据第一个, Guid 是一个构造类型, / strong>一个原始类型。

According to the first one, Guid is a constructed type, not a primitive.

根据第二个,它也是一个原始类型(因为它在BCL中提供, System 命名空间,并且未由任何.NET语言定义)。

According to the second, it is also not a primitive type (as it is provided in the BCL, in the System namespace, and is not defined by any of the .NET languages).

更新:

这是类型类的type.isprimitive.aspxrel =nofollow> IsPrimitive 方法说:

This is what the IsPrimitive method of the Type class says:


基本类型是布尔值,字节,SByte,Int16,UInt16,Int32,UInt32,Int64,UInt64,IntPtr,UIntPtr,Char, Double和Single。

The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Char, Double, and Single.

因此,就.NET而言,类型。

So, as far as .NET is concerned, it is not a primitive type.

结论:根据上述三个独立标准, Guid 绝对不原始类型。

In conclusion: According to the three separate criteria above, Guid is definitely not a primitive type.

这篇关于是Guid是原始类型还是复杂类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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