关闭

18.1 Struct declarations

586人阅读 评论(0) 收藏 举报
A struct-declaration is a type-declaration (§16.5) that declares a new
struct:
struct-declaration:
attributesopt struct-modifiersopt struct identifier struct-interfacesopt
struct-body ;opt
A struct-declaration consists of an optional set of attributes (§24),
followed by an optional set of structmodifiers
(§18.1.1), followed by the keyword struct and an identifier that names the
struct, followed by an
optional struct-interfaces specification (§18.1.2), followed by a
struct-body (§18.1.3), optionally followed
by a semicolon.
18.1.1 Struct modifiers
A struct-declaration may optionally include a sequence of struct modifiers:
struct-modifiers:
struct-modifier
struct-modifiers struct-modifier
struct-modifier:
new
public
protected
internal
private
It is a compile-time error for the same modifier to appear multiple times
in a struct declaration.
The modifiers of a struct declaration have the same meaning as those of a
class declaration (§17.1.1).
18.1.2 Struct interfaces
A struct declaration may include a struct-interfaces specification, in
which case the struct is said to
implement the given interface types.
struct-interfaces:
: interface-type-list
C# LANGUAGE SPECIFICATION
268
Interface implementations are discussed further in §20.4.
18.1.3 Struct body
The struct-body of a struct defines the members of the struct.
struct-body:
{ struct-member-declarationsopt }
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:566094次
    • 积分:11486
    • 等级:
    • 排名:第1344名
    • 原创:565篇
    • 转载:0篇
    • 译文:0篇
    • 评论:50条
    文章分类