/// <summary> /// Try to get a MAMA msg field. /// The result contains the reusable field object of the /// nativeHandle object. Applications calling this method will receive the same /// reusable object for repeated calls on same nativeHandle object. /// </summary> public bool tryField( string name, ushort fid, ref MamaMsgField result) { EnsurePeerCreated(); IntPtr myP = IntPtr.Zero; int code = NativeMethods.mamaMsg_getField(nativeHandle, name, fid, ref myP); if (CheckResultCodeIgnoreNotFound(code) != MamaStatus.mamaStatus.MAMA_STATUS_OK) { return false; } if (mField == null) { mField = new MamaMsgField(); mField.SelfManageLifeTime(false); } mField.setNativeHandle(myP); result = mField; return true; }
/// <summary> /// Get a MAMA msg field. /// The result contains the reusable field object of the /// nativeHandle object. Applications calling this method will receive the same /// reusable object for repeated calls on same nativeHandle object. /// </summary> public MamaMsgField getField( string name, ushort fid, MamaMsgField valueIfMissing) { if (mField == null) { mField = new MamaMsgField (); mField.SelfManageLifeTime(false); } if (tryField (name, fid, ref mField)) return mField; else return valueIfMissing; }