static void EncodeString(ref AuthorizationItem item, string key, string?value) { item.name = Marshal.StringToHGlobalAuto(key); if (value is not null) { item.value = Marshal.StringToHGlobalAuto(value); item.valueLen = value.Length; } }
static void EncodeString(ref AuthorizationItem item, string key, string value) { item.name = Marshal.StringToHGlobalAuto(key); if (value != null) { item.value = Marshal.StringToHGlobalAuto(value); #if XAMCORE_2_0 item.valueLen = value.Length; #else item.valueLen = (IntPtr)value.Length; #endif } }