secondary commit
This commit is contained in:
@@ -2,35 +2,38 @@
|
||||
{
|
||||
using CommonMessurementUnits;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using System;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
int x = 3;
|
||||
Console.WriteLine($"From Int32: {x}");
|
||||
byte[] xb = x.GetBytes();
|
||||
Console.WriteLine(string.Join("", xb.GetBits()));
|
||||
Console.WriteLine(xb.ToHex());
|
||||
long y = BitConverter.ToInt32(xb, 0);
|
||||
Console.WriteLine(y);
|
||||
Console.WriteLine($"Bits: {string.Join("", xb.GetBits())}");
|
||||
Console.WriteLine($"Hex bytes: {xb.ToHex()}");
|
||||
int y = BitConverter.ToInt32(xb, 0);
|
||||
Console.WriteLine($"To Int32: {y}");
|
||||
Console.WriteLine();
|
||||
|
||||
//var model = new TestClass
|
||||
//{
|
||||
// Flow = 1,
|
||||
// Time = 15.56,
|
||||
// Volume = 40,
|
||||
// Pressure = 250000,
|
||||
// Current = 130,
|
||||
// Temperature = 21.9
|
||||
//};
|
||||
var model = new TestClass
|
||||
{
|
||||
Flow = 1,
|
||||
Time = 15.56,
|
||||
Volume = 40,
|
||||
Pressure = 250000,
|
||||
Current = 130,
|
||||
Temperature = 21.9
|
||||
};
|
||||
|
||||
//var modelJson = JsonConvert.SerializeObject(model, Formatting.Indented);
|
||||
//var testModel = JsonConvert.DeserializeObject<TestClass>(modelJson);
|
||||
var modelJson = JsonConvert.SerializeObject(model, Formatting.Indented);
|
||||
var testModel = JsonConvert.DeserializeObject<TestClass>(modelJson);
|
||||
|
||||
//Console.WriteLine(modelJson);
|
||||
//Console.WriteLine(JsonConvert.SerializeObject(testModel, Formatting.Indented));
|
||||
Console.WriteLine($"To Json: {modelJson}");
|
||||
Console.WriteLine($"From Json: {JsonConvert.SerializeObject(testModel, Formatting.Indented)}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user