我的代码如下:
public static unsafe bool ExistInURL(params object[] ob)
{
void* voidPtr = (void*) stackalloc byte[5];//Invalid expression term
*((int*) voidPtr) = 0;
while (*(((int*) voidPtr)) < ob.Length)
{
if ((ob[*((int*) voidPtr)] == null) || (ob[*((int*) voidPtr)].ToString().Trim() == ""))
{
*((sbyte*) (voidPtr + 4)) = 0;//Cannot apply operator '+' to operand of type 'void*' and 'int'
goto Label_004B;
}
*(((int*) voidPtr))++;//The left-hand side of an assignment must be a varibale,property or indexer
}
*((sbyte*) (voidPtr + 4)) = 1;
Label_004B:
return *(((bool*) (voidPtr + 4)));//Cannot apply operator '+' to operand of type 'void*' and 'int'
}
问题是当我尝试构建或运行项目时,我遇到了很多错误。有人有想法么?