locked
New Properties is created when I add a web service reference. RRS feed

  • Question

  • User376261 posted

    When I add a web service reference in my android Project, the any boolean properties is created with "Specified" like a sufix, and if I don't set true I can't to send that information.

    Ex.:

    Dog myDog = new Dog() { Name = "Pluto", NameSpecified = true //This property don't exist in web service project, it was created in my Android Project };

    anybody help...?

    ps: Sorry about my english, I'm learning yet.

    Tuesday, September 18, 2018 3:23 PM

Answers

  • User371688 posted

    @Jorge_Kleber "Specified" fields are only generated on optional parameters that are structs. (int, datetime, decimal etc). All such variables will have additional variable generated with the name Specified.This is a way of knowing if a parameter is really passed between the client and the server. For example, an optional integer, if not passed, would still have the default value of 0. How do you differentiate between this and the one that was actually passed with a value 0 ? The "specified" field lets you know if the optional integer is passed or not. If the "specified" field is false, the value is not passed across. If it true, the integer is passed. Alternatively, you can consider using data types like int?, datatime? and this will avoid generation of the "specified" fields.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, September 19, 2018 8:41 AM

All replies

  • User371688 posted

    @Jorge_Kleber "Specified" fields are only generated on optional parameters that are structs. (int, datetime, decimal etc). All such variables will have additional variable generated with the name Specified.This is a way of knowing if a parameter is really passed between the client and the server. For example, an optional integer, if not passed, would still have the default value of 0. How do you differentiate between this and the one that was actually passed with a value 0 ? The "specified" field lets you know if the optional integer is passed or not. If the "specified" field is false, the value is not passed across. If it true, the integer is passed. Alternatively, you can consider using data types like int?, datatime? and this will avoid generation of the "specified" fields.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, September 19, 2018 8:41 AM
  • User376261 posted

    @jezh said: @Jorge_Kleber "Specified" fields are only generated on optional parameters that are structs. (int, datetime, decimal etc). All such variables will have additional variable generated with the name Specified.This is a way of knowing if a parameter is really passed between the client and the server. For example, an optional integer, if not passed, would still have the default value of 0. How do you differentiate between this and the one that was actually passed with a value 0 ? The "specified" field lets you know if the optional integer is passed or not. If the "specified" field is false, the value is not passed across. If it true, the integer is passed. Alternatively, you can consider using data types like int?, datatime? and this will avoid generation of the "specified" fields.

    I've wanted to know why that property is generated because I thinked that new property wont receved to my service thanks for help :smiley:

    Wednesday, September 26, 2018 1:11 PM