Witajcie!
Dlaczego poniższa funkcja niezależnie od podanej wartości zwraca pusty string?
Proszę o podanie wyjaśnień, nie gotowego kodu
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Morse_Decoder
{
public static class MorseMethods
{
public static Dictionary<string, char> morseCodeLookup = new Dictionary<string, char>()
{
[".- "] = 'a',
["-... "] = 'b',
["-.-. "] = 'c',
["-.. "] = 'd',
[". "] = 'e',
["..-. "] = 'f',
["--. "] = 'g',
[".... "] = 'h',
[".. "] = 'i',
[".--- "] = 'j',
["-.- "] = 'k',
[".-.. "] = 'l',
["-- "] = 'm',
["-. "] = 'n',
["--- "] = 'o',
[".--. "] = 'p',
["--.- "] = 'q',
[".-. "] = 'r',
["... "] = 's',
["- "] = 't',
["..- "] = 'u',
["...- "] = 'v',
[".-- "] = 'w',
["-..- "] = 'x',
["-.-- "] = 'y',
["--.. "] = 'z',
[".---- "] = '1',
["..--- "] = '2',
["...-- "] = '3',
["....- "] = '4',
["..... "] = '5',
["-.... "] = '6',
["--... "] = '7',
["---.. "] = '8',
["----. "] = '9',
["----- "] = '0',
};
public static string DecodeText(string TextToDecode)
{
string Result = "";
string Temp = "";
string[] MorseTextSplit = TextToDecode.Split(' ');
for (int i = 0; i == MorseTextSplit.Length; i++)
{
Temp += MorseMethods.morseCodeLookup[MorseTextSplit[i]];
Result += Temp;
}
return Result;
}
}
}