有[可序列化]和[序列化()在C#中有区别吗?

编程入门 行业动态 更新时间:2024-10-21 20:31:34
本文介绍了有[可序列化]和[序列化()在C#中有区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经碰到了使用任何两个符号的例子。我找不到它的任何事情告诉哪一个是常见的一种,为什么2符号是允许的,如果有实际两者之间的细微差别。

I've bumped into examples using either of both notations. I can't find anything about it what tells which one is the common one, why 2 notations are allowed, and if there is actually any subtle difference between the two.

任何人的想法?

推荐答案

不,没有任何功能上的差异。

Nope, no functional difference.

为什么两种不同的风格,你问?所述第一符号是允许为了简便起见。第二符号是允许的,因为某些属性取参数:

Why the 2 different styles, you ask? The first notation is allowed for brevity. The 2nd notation is allowed because some attributes take parameters:

[Category("Foobar related methods.")] public void Foo() { }

另外请注意,[Serializable接口]实际上只是短期的手[SerializableAttribute()] - C#,您可以省略属性后缀以及空构造括号

Also note that [Serializable] is really just short-hand for [SerializableAttribute()] - C# lets you omit the Attribute suffix as well as the empty constructor parens.

更多推荐

有[可序列化]和[序列化()在C#中有区别吗?

本文发布于:2023-11-11 18:23:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579217.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:序列化   中有   区别

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!