System.Type - 结构 [英] System.Type - structure

查看:68
本文介绍了System.Type - 结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


如果类型(System.Type)是一个值(.IsValueType = True)

而不是原始( .IsPrimitive = False),那个类型是一个结构?


谢谢。

Hello,

is it correct that if a type (System.Type) is a value (.IsValueType=True)
and not primitive (.IsPrimitive=False), that type is a structure?

Thanks.

推荐答案

>如果类型(System.Type)是一个值(.IsValueType = True)
> is it correct that if a type (System.Type) is a value (.IsValueType=True)
而不是原始(.IsPrimitive = False),那么该类型是一个结构吗?
and not primitive (.IsPrimitive=False), that type is a structure?




很容易找到。


*每个*开发人员应该有一个名为Hacks或Tests的虚拟VS.NET解决方案

或类似的东西:


Hacks.sln

DBHacks.dbp

VBConsole.vbproj
VBWindows.vbProj

VBWebHacks.vbProj

CSConsole.csproj

JSWindows.vbProj


(你明白了)


我花了不到五分钟的时间来添加结构定义,测试方法

并修改我的Sub Main( )在VBConsole:

-------------------------------------- ---------

模块模块1


''这是我从创建VB控制台应用程序获得的Module1.vb
''所以我可以尝试一些东西而不需要其他形式的关系编辑

''阻碍我注意力的东西。


私有结构项目

Public Field1 As String

Public Field2 As String

结束结构


Sub Main()


whatType( )


Console.WriteLine(vbCrLf& 按一个键退出。

Console.ReadLine()


结束子


Private Sub whatType()


Dim x As Item


x.Field1 ="这个

x .Field1 ="那个"


Console.WriteLine(" IsValueType ="& x.GetType()。IsValueType.ToString())

Console.WriteLine(" IsPrimitive ="& x.GetType()。IsPrimitive.ToString())

End Sub


''很多其他实验的测试方法'我已经完成了


结束模块


-

Peace&快乐的计算,

Mike Labosh,MCSD


" Mr。 McKittrick经过非常仔细的考虑后,我得到了这个新系统SUCKS的结论。

- Barringer将军,战争游戏< br / >



Easy enough to find out.

*Every* developer should have a dummy VS.NET Solution called Hacks or Tests
or something that looks like this:

Hacks.sln
DBHacks.dbp
VBConsole.vbproj
VBWindows.vbProj
VBWebHacks.vbProj
CSConsole.csproj
JSWindows.vbProj

(you get the idea)

It took me less than five minutes to add a structure definition, test method
and modify my Sub Main() in VBConsole:
-----------------------------------------------
Module Module1

'' This is the Module1.vb I got from creating a VB Console Application
'' so I can experiment with stuff without having other form related
'' stuff getting in the way of my attention span.

Private Structure Item
Public Field1 As String
Public Field2 As String
End Structure

Sub Main()

whatType()

Console.WriteLine(vbCrLf & "Press a key to exit.")
Console.ReadLine()

End Sub

Private Sub whatType()

Dim x As Item

x.Field1 = "This"
x.Field1 = "That"

Console.WriteLine("IsValueType = " & x.GetType().IsValueType.ToString())
Console.WriteLine("IsPrimitive = " & x.GetType().IsPrimitive.ToString())

End Sub

'' Lots of other test methods for other experiment''s I''ve done

End Module

--
Peace & happy computing,

Mike Labosh, MCSD

"Mr. McKittrick, after very careful consideration, I have
come to the conclusion that this new system SUCKS."
-- General Barringer, "War Games"


" Mike Labosh" <毫升***** @ hotmail.com> schrieb
"Mike Labosh" <ml*****@hotmail.com> schrieb
如果类型(System.Type)是值
(。IsValueType = True)而不是原始值(.IsPrimitive = False),这是否正确? ),那个
类型是一个结构?
is it correct that if a type (System.Type) is a value
(.IsValueType=True) and not primitive (.IsPrimitive=False), that
type is a structure?



很容易找到。

*每个*开发人员应该有一个虚拟的VS.NET解决方案叫做Hacks
或测试或看起来像这样的东西:

Hacks.sln
DBHacks.dbp
VBConsole.vbproj
VBWindows.vbProj VBWebHacks.vbProj
CSConsole.csproj
JSWindows.vbProj

(你明白了)

我花了不到五分钟的时间来添加一个结构定义,测试方法并在VBConsole中修改我的Sub Main():



Easy enough to find out.

*Every* developer should have a dummy VS.NET Solution called Hacks
or Tests or something that looks like this:

Hacks.sln
DBHacks.dbp
VBConsole.vbproj
VBWindows.vbProj
VBWebHacks.vbProj
CSConsole.csproj
JSWindows.vbProj

(you get the idea)

It took me less than five minutes to add a structure definition,
test method and modify my Sub Main() in VBConsole:



我认为Qwert的问题不是如何获得这些属性但是如果

值组合IsValueType = true和isprimitive = false是保证

该类型是一个结构(或者如果有的话)呃属性必须是

考虑在内。)

Armin


I think "Qwert"''s question was not how to get these properties but if the
value combination IsValueType=true and isprimitive=false is the guarantee
that the type is a structure (or if there are other properties that must be
taken into account).
Armin


的确,那是我的问题。答案是?
Indeed, that is my question. And the answer is?
...
我认为Qwert的问题不是如何获得这些属性,而是如果
值组合IsValueType = true和isprimitive = false是保证
类型是一个结构(或者是否有其他属性必须考虑在内)。

Armin
...
I think "Qwert"''s question was not how to get these properties but if the
value combination IsValueType=true and isprimitive=false is the guarantee
that the type is a structure (or if there are other properties that must
be taken into account).
Armin



这篇关于System.Type - 结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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