none
How to use "Object" type in C# RRS feed

  • Question

  • I am assigning values to each property of my XSD class .



        [System.Xml.Serialization.XmlElementAttribute("ProductId", typeof(NumericType), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]

        [System.Xml.Serialization.XmlElementAttribute("ProductName", typeof(StandardValueType), Form =   System.Xml.Schema.XmlSchemaForm.Unqualified)]




        public object Item

        {

            get

            {

                return this.itemField;

            }

            set

            {

                this.itemField = value;

            }

        }
    Tuesday, May 21, 2019 7:53 PM

All replies

  • If the type is known e.g. StandardValueType then define the property as this type or the equivalent for C#.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, May 21, 2019 9:42 PM
    Moderator
  • Hi Coding Addict,

    Thank you for posting here.

    For your question, you could refer to the link below.

    https://stackoverflow.com/questions/14624842/c-sharp-set-value-of-xmlserialized-class

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 22, 2019 9:06 AM
    Moderator