Biser
v1.9
.NET DOTNET 용 크로스 플랫폼 바이너리 및 JSON 시리얼 라이저.
RAFT.NET에 사용되는 DBreeze 데이터베이스의 통합 부분
Serialzer에 대한 코드를 작성하려면 다음 줄에 전화하십시오.
var resbof = BiserObjectify . Generator . Run ( typeof ( TS6 ) , true ,
@"D:Temp1" , forBiserBinary : true , forBiserJson : true , null ) ;첫 번째 인수는 직렬화 될 루트 객체의 유형입니다 (직렬화 해야하는 다른 객체를 포함 할 수 있음). 두 번째 인수는 BiserObjectify가 루트 객체에 포함 된 모든 객체에 대해 Serializer를 준비해야 함을 의미합니다. 세 번째 인수는 객체 당 C# 파일이 생성되는 폴더를 가리 킵니다. 네 번째와 다섯 번째 인수는 우리가 바이너리 및 JSON 시리얼 라이저를 모두 사용하고 싶다는 것을 의미합니다. 여섯 번째 인수는 해시 (또는 널)입니다.
RESBOF 변수에는 생성 된 파일에서 사전과 동일한 정보가 포함됩니다.
public partial class TS6
{
public string P1 { get ; set ; }
.. . TS6 t6 = new TS6 ( )
{
P1 = "dsfs" ,
P2 = 456 ,
P3 = DateTime . UtcNow ,
P4 = new List < Dictionary < DateTime , Tuple < int , string > >>
{
new Dictionary < DateTime , Tuple < int , string > > {
{ DateTime . UtcNow . AddMinutes ( - 1 ) , new Tuple < int , string > ( 12 , "testvar" ) } ,
{ DateTime . UtcNow . AddMinutes ( - 2 ) , new Tuple < int , string > ( 125 , "testvar123" ) }
} ,
new Dictionary < DateTime , Tuple < int , string > > {
{ DateTime . UtcNow . AddMinutes ( - 3 ) , new Tuple < int , string > ( 17 , "dsfsdtestvar" ) } ,
{ DateTime . UtcNow . AddMinutes ( - 4 ) , new Tuple < int , string > ( 15625 , "sdfsdtestvar" ) }
}
} ,
P5 = new Dictionary < int , Tuple < int , string > > {
{ 12 , new Tuple < int , string > ( 478 , "dsffdf" ) } ,
{ 178 , new Tuple < int , string > ( 5687 , "sdfsd" ) }
} ,
P6 = new Tuple < int , string , Tuple < List < string > , DateTime > > ( 445 , "dsfdfgfgfg" ,
new Tuple < List < string > , DateTime > ( new List < string > { "a1" , "a2" } , DateTime . Now . AddDays ( 58 ) ) ) ,
P7 = new List < string > { "fgdfgrdfg" , "dfgfdgdfg" } ,
P8 = new Dictionary < int , List < string > > {
{ 34 , new List < string > { "drtttz" , "ghhtht" } } ,
{ 4534 , new List < string > { "dfgfghfgz" , "6546ghhtht" } }
} ,
P25 = new Dictionary < int , List < string [ , ] [ ] [ , , ] > > [ , , , ] [ ] [ , , ]
.. .
} var serializedObjectAsByteArray = t6 . BiserEncoder ( ) . Encode ( ) ;
var retoredBinaryObject = TS6 . BiserDecode ( serializedObjectAsByteArray ) ; var jsonSettings = new Biser . JsonSettings { DateFormat = Biser . JsonSettings . DateTimeStyle . ISO } ;
string prettifiedJsonString = new Biser . JsonEncoder ( t6 , jsonSettings )
. GetJSON ( Biser . JsonSettings . JsonStringStyle . Prettify ) ;
var restoredJsonObject = TS6 . BiserJsonDecode ( prettifiedJsonString , settings : jsonSettings ) ; 깊은 이해를 위해 :
문서 바이너리 바이저
문서 JSON BISER
수동 인코더/디코더의 예