Setting and getting member values

To set a union member, simply set the property for that member. The discriminator value changes automatically to match the member you set.

To access the value of a member, first verify that the discriminator value is in the set of allowable cases for that member, then reference the matching property. The ActiveX proxy throws an exception if you attempt to access a member while the discriminator value is not in the set of case values for that member.

NoteExplicit version implicit field initialization Union fields that use complex types such as struct, union, object, date, time, or timestamp must be initialized explicitly. If you do not initialize these fields before passing the union as an EAServer method parameter or return value, the ActiveX dispatcher throws a marshalling exception. Fields of other types are implicitly set to a default value.