开发者

Is any rule to detect that object is serializable in C#? [duplicate]

开发者 https://www.devze.com 2023-01-12 14:23 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: How to check if an object is serializable in C#
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

How to check if an object is serializable in C#

Recently found the following sente开发者_运维百科nce:

"Just to enhance, take a thumb rule, the object that support .ToString() are all serializable objects."

This looks like strange as all objects have .ToString() method so in this case all objects must be serializable. Is this sentence make sense?

Also is any rule to detect that specific object is serializable?


If found this article helpfull on this topic:

http://msdn.microsoft.com/en-us/library/ms973893.aspx

The ToString() is not defined to serialize an object. You could implement a class that does have this behaviour but I don't think this would be a good idea.

And yep: already asked. Thought so...

How to check if an object is serializable in C#

0

精彩评论

暂无评论...
验证码 换一张
取 消