I get an error in Visual Studio: 'char' does not contain a definition for split, and no extension method 'Split' accepting a first argument of type 'char' could be found (are you missing a using directive or an assembly reference?)
This is my code:
private void BuildData(string data)
{
var endOfText = "b4";
if (data.EndsWith(endOfText))
{
this.lastMessage.Append(data);
Parse(this.lastMessage.ToString());
this.lastMessage.Clear();
}
else
{
this.lastMessage.Append(data);
}
}
public static void ParseLength(string text)
{
const int skillId = 1;
const int queueId = 2;
var skills = text[skillId].Split('\t'); // Split error
var queueLengths = text[queueId].Split('\t'); // Split error
var res = new SkillColl();
for (var i = 0; i < skills.Length; i++)
{
try
{
var skill = Int32.Parse(skills[i]);
var queueLength = Int32.Parse(queueLengths[i]);
result.Add(skill, queueLength);
}
catch (Exception ex)
{
log.Error(ex);
}
}
queueLengths = res;
}
how to parse this two value the most optimised way, without writing the whole code again:
var skills
var queueLengths