コード例 #1
0
    static void Main(string[] args)
    {
        try
        {
            XTest xtest = new XTest()
            {
                PropertyName = "Raj"
            };

            StringBuilder xmlString = new StringBuilder();
            using (XmlWriter xtw = XmlTextWriter.Create(xmlString))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(XTest), GetXmlAttributeOverrides(typeof(XTest)));
                serializer.Serialize(xtw, xtest);

                xtw.Flush();
            }

            Console.WriteLine(xmlString.ToString());
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
    }
コード例 #2
0
        public void ExistsValueTest()
        {
            XTest xx = (XTest)3;

            Assert.IsFalse(EnumUtil.ExistsValue <XTest>(xx));
            xx = (XTest)1;
            Assert.IsTrue(EnumUtil.ExistsValue <XTest>(xx));
            xx = XTest.A;
            Assert.IsTrue(EnumUtil.ExistsValue <XTest>(xx));
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: jeason0813/DBreezeBased
        void Test6()
        {
            //https://developers.google.com/protocol-buffers/docs/encoding
            //https://developers.google.com/protocol-buffers/docs/overview?hl=en
            DBreezeBased.DocumentsStorage.Document doc = new DBreezeBased.DocumentsStorage.Document()
            {
                DocumentSpace = "space1",
                //Content = new byte[1000],
                Content              = new byte[] { 1, 23, 56 },
                DocumentSpaceId      = 15,
                DocumentSequentialId = 12,
                InternalId           = 77,
                InternalStructure    = new byte[] { 24, 64, 88, 67 },
                DocumentName         = "name 1",
                ExternalId           = "e1",
                Searchables          = "table song",
                Description          = "descr 1"
            };


            //byte[] ff = doc.SerializeProtobuf();
            XTest xt = new XTest();

            xt.A = 150;
            xt.B = 150;
            xt.C = 150;

            //Defining first byte
            int k  = (4 << 3) | 0;
            int k1 = (2 << 3) | 0;


            byte[] df = xt.SerializeProtobuf();

            //-----  Digits

            int v = 127;

            byte[] b0 = v.SerializeProtobuf();
            byte[] b1 = BitConverter.GetBytes(v);

            //for (int i = 0; i < b1.Length; i++)
            //{
            //    b1[i]
            //}
        }