草庐IT

GetFirstOccurance

全部标签

c# - 在 Byte[] 数组中查找第一个特定字节 c#

我有一个字节数组,希望找到特定字节的第一次出现(任何)。你们能帮我找到一个漂亮、优雅和高效的方法吗?///Summary///Findsthefirstoccuranceofaspecificbyteinabytearray.///Ifnotfound,returns-1.publicintGetFirstOccurance(bytebyteToFind,byte[]byteArray){} 最佳答案 publicstaticintGetFirstOccurance(bytebyteToFind,byte[]byteArray){r