private static DDS.TypeCode create_type_code(DDS.TypeCodeFactory tcf) { DDS.UnionMemberSeq members = new DDS.UnionMemberSeq(); /* First, we create the typeCode for a union */ /* Default-member index refers to which member of the union * will be the default one. In this example index = 1 refers * to the the member 'aLong'. Take into account that index * starts in 0 */ try { DDS.TypeCode unionTC = tcf.create_union_tc("Foo", DDS.ExtensibilityKind.MUTABLE_EXTENSIBILITY, DDS.TypeCode.TC_LONG, 1, /* default-member index */ members); /* For now, it does not have any member */ /* Case 1 will be a short named aShort */ unionTC.add_member("aShort", DDS.DynamicData.MEMBER_ID_UNSPECIFIED, DDS.TypeCode.TC_SHORT, DDS.TypeCode.NONKEY_MEMBER); /* Case 2, the default, will be a long named aLong */ unionTC.add_member("aLong", 2, DDS.TypeCode.TC_LONG, DDS.TypeCode.NONKEY_MEMBER); /* Case 3 will be a double named aDouble */ unionTC.add_member("aDouble", 3, DDS.TypeCode.TC_DOUBLE, DDS.TypeCode.NONKEY_MEMBER); return unionTC; } catch (Exception e) { Console.WriteLine("register_type error {0}", e); return null; } }