MikValSor.SerializableValidator
1.0.4
.NET Standard 2.0
.NET Framework 4.5
Install-Package MikValSor.SerializableValidator -Version 1.0.4
dotnet add package MikValSor.SerializableValidator --version 1.0.4
<PackageReference Include="MikValSor.SerializableValidator" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MikValSor.SerializableValidator --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MikValSor.SerializableValidator, 1.0.4"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MikValSor.SerializableValidator as a Cake Addin
#addin nuget:?package=MikValSor.SerializableValidator&version=1.0.4
// Install MikValSor.SerializableValidator as a Cake Tool
#tool nuget:?package=MikValSor.SerializableValidator&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Library for validating that .NET types are serializable and deserialize with System.Runtime.Serialization.
Example:
class MyClass
{
public string Value;
}
[System.Serializable]
class MyOtherClass : System.Runtime.Serialization.ISerializable
{
public string Value;
public MyOtherClass()
{
}
private MyOtherClass(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
{
Value = (string)info.GetValue("Value", typeof(string));
}
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
{
info.AddValue("Value", Value, typeof(string));
}
}
void Validate()
{
var validator = new MikValSor.Runtime.Serialization.SerializableValidator();
var myObject = new MyClass();
bool isMyObjectImmutable = validator.IsSerializable(myObject);
System.Console.WriteLine($"Is myObject serializable: {isMyObjectImmutable}");
var myOtherObject = new MyOtherClass();
bool isMyOtherObjectImmutable = validator.IsSerializable(myOtherObject);
System.Console.WriteLine($"Is myOtherObject serializable: {isMyOtherObjectImmutable}");
}
/**
Output:
Is myObject serializable: False
Is myOtherObject serializable: True
**/
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.5
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on MikValSor.SerializableValidator:
Package | Downloads |
---|---|
MikValSor.EnsuredImmutable
Package Description |
|
MikValSor.ImmutableStore
Library for storage of immutable .Net types. |
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.0.4
- Added NullIsNotSerializable instead for ArgumentNullException
- Changes names of Exceptions to have Exception in end of name.
v1.0.3
- Added singelton instance
v1.0.2
- Added support for structs
v1.0.1
- Changed target to not allow null.
v1.0.0
- Initial release.