private static extern int navigator_set_orientation(NavigatorOrientation angle, [In, Out]ref IntPtr id);
public static string SetOrientation(NavigatorOrientation angle) { if (!angle.IsValidValue()) { throw new ArgumentException("not a valid orientation value.", "angle"); } var id = IntPtr.Zero; var success = navigator_set_orientation(angle, ref id) == BPS.BPS_SUCCESS; if (success) { using (var str = new BPSString(id)) { return str.Value; } } else { BPS.bps_free(id); } return null; }