-3
public void SteamaccountGrab()
{
    if (Directory.Exists(steamaccountDir32))
    {
        string steamaccountDir = @"C:\Program Files\Steam\config";
    }
    else
    {
        if (Directory.Exists(steamaccountDir64))
        {
            string steamaccountDir = @"C:\Program Files (x86)\Steam\config";
        }
        else 
        {
            bool steamisinstalled = false;
        }

    }
    if (steamisinstalled)
    { 

    }
}

ところで、私はすでに bool steamisinstalled を true として宣言しました

このコードでは、「if (steamisinstalled)」で、steamisinstalled が宣言と競合するというエラーが表示されます。何が間違っているのか、および/またはこれを修正するために何をしなければならないのかわかりません。どんな助けでも大歓迎です!

4

2 に答える 2

3

あなたboolbool steamisinstalled = false;言うので、あなたはすでにそれを宣言しています。

于 2013-06-01T18:25:27.957 に答える
2

bool steamisinstalled = false;のスコープ内で宣言しelse、競合を引き起こしている外側のスコープで参照しています。

宣言を外側のスコープに移動すると、エラーが解決するはずです。

于 2013-06-01T18:25:24.863 に答える