Questions tagged [serializableattribute]
3 questions
3
votes
3 answers
C# Generic method as extension with where clause
I want to create an extension which can run only for Serializable classes.
Is there a code like this:
using System;
namespace ConsoleApplication2
{
[Serializable]
public class Ser
{
}
public class NonSer
{
}
…

uzay95
- 16,052
- 31
- 116
- 182
2
votes
0 answers
How to make all C# classes in an assembly serializable
Is there an easy way to make all classes in an assembly serializable instead of putting [Serializable] manually on top of each class?
I can't use reflection as attributes are static metadata and cannot be added dynamically, and I'm out of ideas how…

U. Bulle
- 1,075
- 9
- 20
0
votes
1 answer
DataContractSerializer unexpected behavior consuming SerializableAttribute
I am trying to use the DataContractSerializer to serialize a simple object:
public class MyType {
public string MyValue { get; set; }
}
I have done extensive research and discovered that according to MSDN, contrary to popular belief, the…

tsemer
- 2,959
- 3
- 29
- 26