[英]Equivalent System.Data.Linq.Binary in .net core
Can anyone help me for convert this code in .net core : 谁能帮助我在.net core中转换此代码:
private static string GetValueFromModelValue(object formValue)
{
//Test to determine if its binary data. If it is, we need to convert it to a base64 string.
Binary binaryValue = formValue as Binary;
if (binaryValue != null)
{
formValue = binaryValue.ToArray();
}
//If the above conversion to an array worked, then the following will cast as a byte array and convert.
byte[] byteArrayValue = formValue as byte[];
if (byteArrayValue != null)
{
formValue = Convert.ToBase64String(byteArrayValue);
}
return formValue.ToString();
}
The types in System.Data.Linq
are not available in a version of .NET Core and .NET Standard (currently 1.0 - 2.0). System.Data.Linq
中的类型在.NET Core和.NET Standard版本(当前为1.0-2.0)中不可用。
Since no caller can pass in a Binary
object on .NET Core, you can either remove the code or put it inside a preprocessor define (this example assumes building for .NET Core 1.1): 由于没有调用者可以传递.NET Core上的
Binary
对象,因此您可以删除代码或将其放入预处理器定义中(此示例假定针对.NET Core 1.1进行构建):
#if !NETCOREAPP1_1
Binary binaryValue = …
if (binaryValue != null)
{
…
}
#endif
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.