• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ObjectReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ObjectReader的典型用法代码示例。如果您正苦于以下问题:C# ObjectReader类的具体用法?C# ObjectReader怎么用?C# ObjectReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ObjectReader类属于命名空间,在下文中一共展示了ObjectReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Read

        public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
        {
            if (ReferenceStructure(input, reader, optionsOverride))
                return;

            if (ShouldWriteTypeIdentifier(reader.Options, optionsOverride))
                writer.BeginStructure(CurrentTypeResolver.GetTypeIdentifier(Type), reader.GetType());
            else
                writer.BeginStructure(Type);

            for (int i = 0; i < AllSerializableProperties.Length; i++)
            {
                PropertyDefinition property = AllSerializableProperties[i];

                if (property.MatchesPropertyFilter(reader.Options))
                {
                    writer.AddProperty(property.SerializedName);

                    reader.PropertyStack.Push(property);

                    object value = property.GetFrom(input);
                    property.Read(value, reader, writer);

                    reader.PropertyStack.Pop();
                }
            }

            writer.EndStructure();
        }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:29,代码来源:DefaultStructureDefinition.cs


示例2: Read

 public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
 {
     if (writer.CanWrite(input))
         writer.Write(input);
     else
         base.Read(input, reader, writer, optionsOverride);
 }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:7,代码来源:ValueTypeDefinition.cs


示例3: SetUp

		public override void SetUp()
		{
			base.SetUp();
			tr = new TestRepository<Repository>(db);
			reader = db.NewObjectReader();
			inserter = db.NewObjectInserter();
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:7,代码来源:NoteMapTest.cs


示例4: ReadInternalChild

		// Some versions of glade call the menu an internal child, some don't

		protected override ObjectWrapper ReadInternalChild (ObjectReader reader, XmlElement child_elem)
		{
			if (child_elem.GetAttribute ("internal-child") == "menu")
				return ReadChild (reader, child_elem);
			else
				return base.ReadInternalChild (reader, child_elem);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:9,代码来源:OptionMenu.cs


示例5: ReadStamp

        public void ReadStamp(ObjectReader reader)
        {
            TypeModule = reader.Modules.Read();
            GenericFullName = reader.PrimitiveReader.ReadString();

            Resolve();
        }
开发者ID:StepWoodProductions,项目名称:Migrant,代码行数:7,代码来源:TypeFullDescriptor.cs


示例6: ReadStructureStampIfNeeded

 public void ReadStructureStampIfNeeded(ObjectReader reader, VersionToleranceLevel versionToleranceLevel)
 {
     if(StampHelpers.IsStampNeeded(this, reader.TreatCollectionAsUserObject))
     {
         ReadStructureStamp(reader, versionToleranceLevel);
     }
 }
开发者ID:StepWoodProductions,项目名称:Migrant,代码行数:7,代码来源:TypeFullDescriptor.cs


示例7: Read

        public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
        {
            IDictionary dictionary = input as IDictionary;
            if (dictionary == null) return;

            if (ReferenceStructure(input, reader, optionsOverride))
                return;

            if (ShouldWriteTypeIdentifier(reader.Options, optionsOverride))
                writer.BeginStructure(CurrentTypeResolver.GetTypeIdentifier(Type), reader.GetType());
            else
                writer.BeginStructure(Type);

            foreach (object key in dictionary.Keys)
            {
                // Convert.ToString is in case the keys are numbers, which are represented
                // as strings when used as keys, but can be indexed with numbers in JavaScript
                string name = Convert.ToString(key, CultureInfo.InvariantCulture);
                object value = dictionary[key];

                writer.AddProperty(name);
                ValueTypeDef.ReadObject(value, reader, writer, PartialOptions.Default);
            }

            writer.EndStructure();
        }
开发者ID:soxtoby,项目名称:ForSerial,代码行数:26,代码来源:JsonDictionaryDefinition.cs


示例8: Read

 public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
 {
     if (ReferenceStructure(input, reader, optionsOverride))
         return;
     reader.AddReference();
     writer.Write(input);
 }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:7,代码来源:ObjectDefinition.cs


示例9: SetUp

		public override void SetUp()
		{
			base.SetUp();
			db = CreateBareRepository();
			reader = db.NewObjectReader();
			test = new TestRepository<FileRepository>(db);
		}
开发者ID:shoff,项目名称:ngit,代码行数:7,代码来源:AbbreviationTest.cs


示例10: Read

 public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
 {
     if ((optionsOverride.EnumSerialization ?? reader.Options.EnumSerialization) == EnumSerialization.AsString)
         writer.Write(input.ToString());
     else
         writer.Write((int)input);
 }
开发者ID:soxtoby,项目名称:ForSerial,代码行数:7,代码来源:EnumDefinition.cs


示例11: ReadChild

		protected override ObjectWrapper ReadChild (ObjectReader reader, XmlElement child_elem)
		{
			hasLabel = false;
			if (checkbutton.Child != null)
				checkbutton.Remove (checkbutton.Child);
			return base.ReadChild (reader, child_elem);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:7,代码来源:CheckButton.cs


示例12: Read

 public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
 {
     Guid? guid = input as Guid?;
     if (guid == null)
         writer.WriteNull();
     else
         writer.Write(guid.ToString());
 }
开发者ID:soxtoby,项目名称:ForSerial,代码行数:8,代码来源:GuidDefinition.cs


示例13: ReadChildren

		protected override void ReadChildren (ObjectReader reader, XmlElement elem)
		{
			// Ignore changes in the buttons while loading
			actionArea.ContentsChanged -= ButtonsChanged;
			base.ReadChildren (reader, elem);
			actionArea.ContentsChanged += ButtonsChanged;
			actionArea.SetActionDialog (this);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:8,代码来源:Dialog.cs


示例14: Read

        public override void Read(ObjectReader reader)
        {
            var size = reader.PrimitiveReader.ReadInt32();
            nameAsByteArray = reader.PrimitiveReader.ReadBytes(size);
            Name = Encoding.UTF8.GetString(nameAsByteArray);

            UnderlyingType = TypeProvider.GetType(Name);
        }
开发者ID:StepWoodProductions,项目名称:Migrant,代码行数:8,代码来源:TypeSimpleDescriptor.cs


示例15: Main

        static void Main(string[] args)
        {
            IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Loopback, 4040);
            Socket ss = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            var productos = new ObservableCollection<Producto>();
            for (int i = 0; i < 20; i++)
            {
                productos.Add(new Producto()
                {
                    ProductId = i,
                    Nombre = "Producto servidor" + i,
                    Precio = (decimal)i,
                    CantidadDisponible = i * 10,
                    Descripcion = "The enum keyword is used to declare an enumeration, a distinct type that consists of a set of named constants called the enumerator list. Usually it is best to"
                });
            }

            try
            {
                ss.Bind(localEndPoint);
                ss.Listen(10);
                while (true)
                {
                    Console.WriteLine("Servidor escuchando por conexiones");
                    Socket cliente = ss.Accept();
                    string descCliente = cliente.LocalEndPoint.ToString();
                    Console.WriteLine("Conexion aceptada " + descCliente);
                    ObjectWriter w = new ObjectWriter(cliente);
                    ObjectReader r = new ObjectReader(cliente);

                    Transacciones transaccion = (Transacciones)r.ReadInt32();
                    switch (transaccion)
                    {
                        case Transacciones.SolicitarCarrito:
                            Console.WriteLine("\tSolicitud de carrito por: " + descCliente);
                            w.WriteInt32(productos.Count);
                            for (int i = 0; i < productos.Count; i++)
                            {
                                w.WriteObject<Producto>(productos[i]);
                            }
                            break;
                        case Transacciones.RealizarCompra:
                            Console.WriteLine("\tOrden de compra de " + descCliente);
                            Orden o = r.ReadObject<Orden>();
                            productos[o.ProductId].CantidadDisponible -= o.Cantidad;
                            break;
                    }
                    Console.WriteLine("Conexion terminada " + descCliente);
                    cliente.Shutdown(SocketShutdown.Both);
                    cliente.Close();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
开发者ID:rokerdan,项目名称:aplicaciones-redes,代码行数:58,代码来源:Program.cs


示例16: ReadChild

		protected override ObjectWrapper ReadChild (ObjectReader reader, XmlElement child_elem)
		{
			if ((string)GladeUtils.GetChildProperty (child_elem, "type", "") == "label_item") {
				ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"]);
				expander.LabelWidget = (Gtk.Widget)wrapper.Wrapped;
				return wrapper;
			} else
				return base.ReadChild (reader, child_elem);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:9,代码来源:Expander.cs


示例17: SetUp

		public override void SetUp()
		{
			base.SetUp();
			tr = new TestRepository<Repository>(db);
			reader = db.NewObjectReader();
			inserter = db.NewObjectInserter();
			merger = new DefaultNoteMerger();
			noteOn = tr.Blob("a");
			baseNote = NewNote("data");
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:DefaultNoteMergerTest.cs


示例18: ReadChild

		protected override ObjectWrapper ReadChild (ObjectReader reader, XmlElement child_elem)
		{
			if ((string)GladeUtils.GetChildProperty (child_elem, "type", "") == "tab") {
				ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"], this);
				Gtk.Widget widget = (Gtk.Widget)wrapper.Wrapped;
				notebook.SetTabLabel (notebook.GetNthPage (notebook.NPages - 1), widget);
				tabs.Add (widget);
				return wrapper;
			} else
				return base.ReadChild (reader, child_elem);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:11,代码来源:Notebook.cs


示例19: ReadChild

		protected override ObjectWrapper ReadChild (ObjectReader reader, XmlElement child_elem)
		{
			ObjectWrapper ret = null;
			if (Type == ButtonType.Custom || reader.Format == FileFormat.Glade) {
				if (button.Child != null)
					button.Remove (button.Child);
				ret = base.ReadChild (reader, child_elem);
				FixupGladeChildren ();
			} else if (Type == ButtonType.TextAndIcon)
				ConstructContents ();
			return ret;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:12,代码来源:Button.cs


示例20: Read

        public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
        {
            IEnumerable inputArray = input as IEnumerable;
            if (inputArray == null) return;

            writer.BeginSequence();

            foreach (object item in inputArray)
                ItemTypeDef.ReadObject(item, reader, writer, optionsOverride);

            writer.EndSequence();
        }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:12,代码来源:SequenceDefinition.cs



注:本文中的ObjectReader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ObjectReference类代码示例发布时间:2022-05-24
下一篇:
C# ObjectPropertyList类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap