/// <summary>
/// 判断字节数组是否为空,空返回false 不为空true
/// </summary>
/// <param name="object1"></param>
/// <returns>判断字节数组object1是否为空,空返回false 不为空true</returns>
public static bool BytesIsNull(object object1)
{
bool flag = false;
// System.Object obj = ...; // 获取对象的方式
if (object1 is System.DBNull)
{
// 如果obj是System.DBNull的实例,那么执行这里的代码
return flag;
}
else
{
// 如果obj不是System.DBNull的实例,那么执行这里的代码
string obj = object1.ToString();
if (!string.IsNullOrEmpty(obj))
{
byte[] imageBytes = (byte[])object1;
using (MemoryStream ms = new MemoryStream(imageBytes))
{
if (ms.Length == 0)
{
//Console.WriteLine("LONGBLOB数据为空");
return flag;
}
else
{
// Console.WriteLine("LONGBLOB数据不为空");
return true;
}
}
}
}
return flag;
}
12-31
04-11
08-28
05-25
3444
03-06
1742
03-14
239
05-07
05-28
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交