IoDeSer 0.5.0
dotnet add package IoDeSer --version 0.5.0
NuGet\Install-Package IoDeSer -Version 0.5.0
<PackageReference Include="IoDeSer" Version="0.5.0" />
<PackageVersion Include="IoDeSer" Version="0.5.0" />
<PackageReference Include="IoDeSer" />
paket add IoDeSer --version 0.5.0
#r "nuget: IoDeSer, 0.5.0"
#addin nuget:?package=IoDeSer&version=0.5.0
#tool nuget:?package=IoDeSer&version=0.5.0
Introduction
Repository stores code for C# library that allows to read from and write to .io file format. Written in .NET Standard 2.0
About
.io file is a text format that contains serialized object. Each object is stored between two vertical bars |X| in one line for primitive object or more, for iterables and structures. It is build to be cross-platform, language-independent and human-readable.
You can read more about .io de/serialization file format goal and mission here.
Functions and plans
- Primitive types (int, char)
- Strings
- Classes and structures
- Arrays (and jagged arrays)
- Any IEnumerable collection (List)
- Dictionaries
- Dates and time
- Null
- Multidimensional arrays are planned
Capabilities
- Serialization of supported types to string or stream using static methods WriteToString / WriteToFile,
- Deserialization of supported types from or stream using static methods ReadFromString / ReadFromFile,
- Renaming class properties in serialized string using IoItemName attribute,
- Changing order of properties in class in serialized string using IoItemOrder (for specific property) / IoItemsOrder (for the whole class),
- Ignoring public properties in serialization with IoItemIgnore attribute.
Refer to example below to see, how you can utilize those capabilities and how they affect the serialized string.
Example usage
using IoDeSer;
using IoDeSer.Attributes;
using IoDeSer.Attributes.Ordering;
using System.Diagnostics;
namespace ProgramNamespace
{
class Person<T>
{
[IoItemName("FirstName")]
public string Name { get; set; }
[IoItemOrder(ItemOrder.LAST)]
public string SecondName { get; set; }
[IoItemName("Surname")]
public string LastName { get; set; }
[IoItemOrder(2)]
public byte Age { get; set; }
[IoItemOrder(ItemOrder.FIRST)]
public List<Address<T>> Addresses { get; set; }
}
[IoItemsOrder(ItemsOrder.SHORTEST_FIRST)]
class Address<T>
{
public string City { get; set; }
public string StreetName { get; set; }
public T Number { get; set; }
}
internal class Program
{
static void Main(string[] args)
{
Person<int> person = new Person<int>()
{
Name="John", SecondName=null, LastName="Smith", Age=36,
Addresses = new List<Address<int>>
{
new Address<int> {City="Hamburg", StreetName="Strasse", Number=55},
new Address<int> {City="Las Vegas", StreetName="Black", Number=1549}
}
};
string io_string = IoFile.WriteToString(person);
Console.Write(io_string);
Person<int> read_person = IoFile.ReadFromString<Person<int>>(io_string);
Debug.Assert(read_person.Name == person.Name);
Debug.Assert(read_person.Age == person.Age);
Debug.Assert(read_person.Addresses[1].City == person.Addresses[1].City);
}
}
}
/*
Output:
|
Addresses->|
|
City->|Hamburg|
Number->|55|
StreetName->|Strasse|
|
+
|
City->|Las Vegas|
Number->|1549|
StreetName->|Black|
|
|
Surname->|Smith|
Firstname->|John|
SecondName->|||
|
*/
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added support for de/serialization of Enums.