[英]Can i access the Inner Class which is not serialized
I am having a class Which implements serializable interface, it has one inner class which is not implementing serializable interface. 我有一个实现可序列化接口的类,它有一个不实现可序列化接口的内部类。
So Can i access the content of inner class at the receiver. 因此,我可以在接收方访问内部类的内容吗?
Thanks in advance. 提前致谢。
If the inner class doesn't implement Serializable
, it cannot be serialized. 如果内部类未实现
Serializable
,则无法对其进行序列化。 Any attempt to do so would throw NotSerializableException
at the sender. 任何尝试这样做都会在发送方抛出
NotSerializableException
。 As you would have discovered yourself when you tried it. 就像您在尝试时会发现自己一样。
The answer is No. Any data you expect as receiver need serialization. 答案是否定的。您希望作为接收器的任何数据都需要序列化。 Inner class must implement ISerializable.
内部类必须实现ISerializable。
it has one inner class which is not implementing serializable interface.
它有一个内部类,它没有实现可序列化的接口。 So Can i access the content of inner class at the receiver.
因此,我可以在接收方访问内部类的内容吗?
No. If it is not marked as Serializable
, it can't be serialized. 否。如果未标记为
Serializable
,则无法序列化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.