private static T GetConvertedValue <T>(IntPtr value) { var result = Extend.GetProxy(value, true); if (result is T castedResult) { return(castedResult); } if (ReferenceEquals(result, null)) { return(default(T)); } return(Extend.ConvertValue <T>(result)); }