mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-18 17:48:01 +08:00
升级到.Net 9
This commit is contained in:
@@ -546,30 +546,7 @@ namespace Infrastructure.Extensions
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
public static byte[] ToBytes(this object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
var bf = new BinaryFormatter();
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
bf.Serialize(ms, obj);
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static object ToObject(this byte[] source)
|
||||
{
|
||||
using (var memStream = new MemoryStream())
|
||||
{
|
||||
var bf = new BinaryFormatter();
|
||||
memStream.Write(source, 0, source.Length);
|
||||
memStream.Seek(0, SeekOrigin.Begin);
|
||||
var obj = bf.Deserialize(memStream);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 将object转换为char类型信息。
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
Reference in New Issue
Block a user