首页 > 解决方案 > 在循环内创建列表时,由于其保护级别而无法访问

问题描述

public List<string> output = new List<string>();

List<string> newNumeralSystem(char number) {
    string Alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    char[]a = new char[25];
    a = Alph.ToCharArray();
    int ac = Array.IndexOf(a,number);

    for(int x = 0; x > 25; x++)
    {
        int m = ac - x;

        if(m != 0)
        {
            //output[x] = string.Format(a[m] +"+"+ a[x]);
            output.Add(new string(){a[m] + "+" + a[x]});
        }
    }

    return output;      
}

我不断收到这个

错误 CS0122:SpanHelpers.Add<T>(IntPtr, int)由于其保护级别而无法访问

标签: c#

解决方案


推荐阅读