c# - Why are interfaces not [Serializable]? -


i think adding attribute interface helpful make sure not create classes use interface , forget make them serializable.

this fundamental question, wanted ask experts.

interfaces define contract , not have state of own.

serialization saving , loading state , out of object model.

not point serializing holds no state.


to answer practical question of forcing implementation of interface serializable - why iserializable interface exists.

in .net can declare interface should implement other interfaces:

interface mustbeserializable : iserializable {} 

see more information here.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -