Unreachable code detected 错误是什么错误啊,帮我看看,谢谢!!

wqjch 2005-04-28 08:42:33
Util类运行时出现错误;
public class Util
{
public static string Encrypt(string InnerCode)
{
return InnerCode;

byte[] bt= new Byte[InnerCode.Length];

for(int i=0;i<InnerCode.Length;i++)
{
bt[i]=(byte)InnerCode[i];
}

HashAlgorithm thm=MD5.Create();
byte[] btResult=thm.ComputeHash(bt);

return System.Convert.ToBase64String(btResult);
}
}

错误出现在byte
byte[] bt= new Byte[InnerCode.Length];
具体错误为:Unreachable code detected
请大家帮忙解决

...全文
1835 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
JasonHeung 2005-04-28
  • 打赏
  • 举报
回复
你要测试的话:
public class Util
{
public static string Encrypt(string InnerCode)
{
return InnerCode;
/*
byte[] bt= new Byte[InnerCode.Length];

for(int i=0;i<InnerCode.Length;i++)
{
bt[i]=(byte)InnerCode[i];
}

HashAlgorithm thm=MD5.Create();
byte[] btResult=thm.ComputeHash(bt);

return System.Convert.ToBase64String(btResult);
*/
}
}
ruihuahan 2005-04-28
  • 打赏
  • 举报
回复
把return InnerCode;放在第一句,后面的代码永远也不会执行到了,当然Unreachable了。

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧