Пример #1
0
        public string Serialize(MyPartlySensitiveObject partlySensitiveObject)
        {
            //var sensitiveStringConverter = new SensitiveStringJsonConverterNonGeneric();
            var sensitiveStringConverter = new SensitiveStringJsonConverter();
            var converters = new JsonConverter[1];

            converters[0] = sensitiveStringConverter;
            var json = JsonConvert.SerializeObject(partlySensitiveObject, converters);

            return(json);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var partlySensitiveObject = new MyPartlySensitiveObject();

            partlySensitiveObject.CPRNumber = new SensitiveString("100200300400");
            partlySensitiveObject.Gender    = "Male";
            partlySensitiveObject.FullName  = "John Doe";
            partlySensitiveObject.Income    = new SensitiveString("100000");
            var serializer = new SensitiveDataSerializer();
            var json       = serializer.Serialize(partlySensitiveObject);

            Console.WriteLine(json);
        }