.net核心中的等效System.Data.Linq.Binary

时间:2017-05-31 18:01:22

标签: c# asp.net-core .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();
    }

1 个答案:

答案 0 :(得分:0)

{1}中的类型在.NET Core和.NET Standard版本(目前为1.0 - 2.0)中不可用。

由于没有调用者可以传入.NET Core上的System.Data.Linq对象,因此您可以删除代码或将其放在预处理器定义中(此示例假定为.NET Core 1.1构建):

Binary
相关问题