<分区>
我想创建一个翻转字符串顺序的函数
示例:"hi"=> "ih"
这是我到目前为止得出的代码:
public static string Flip(this string Str)
{
char[] chararray = Str.ToCharArray();
string output = "";
chararray. //i dont know what methoud should be used to execute action
return output;
}
问题是,我想知道在 lambda 表达式中,当前选择的对象的索引是什么 ex:x
in (x => x )
indexOf
不是一个选项,因为同一类型可以有多个字符
我怎么知道索引?
编辑: 我不想知道如何反转字符串,我想知道如何在 lambda 表达式中找到对象的索引