title: How to get specific parts of string and assign them to variables in c#?
body: <p>passing a string like this to the code behind:</p>
  
  <p>0,-1|1,-1|2,-1|3,-1|4,-1|5,-1|6,-1|7,-1|8,-1</p>
  
  <p>I need to be able to asign the values before and after the "," symbol per each "|" symbol that exits in the string, into separated variables, "line" for first value (before the ",") and "group" for the next one (after the ",").</p>
  
  <p>Right now I'm trying with this, but I'm having some issues with converting from string[] to string.</p>
  
  <pre><code>public static string GuardarGrupos(string parametro){
  
  
      var data = parametro.Split(Convert.ToChar("|"));
  
      var datos = "";
      string[] linea;
      var grupo = "";
  
      //Iterate through each of the letters
      foreach (var check in data)
      {
  
          datos = data[0];
          linea = data[0].Split(Convert.ToChar(","));
  
      }
  
      return linea;
  }
  </code></pre>
  
  <p>Any Idea how can I achieve this? </p>