title: How can I add a XmlNode to XmlNode List , if I have XmlNodeList and I want to create two XmlNodeList out of them.?
body: <p>I have one <code>XmlNodeList</code>, I want to create two <code>XmlNodeList</code> out of this. I will be checking for some tag inside each item in List, on the basis of that tag presence I will be adding them to one of the list which I have defined. </p>
  
  <p>I was trying to add the list but I did not any method to add the particular item to a new <code>XmlNodeList</code> which is null in the start . Please  help out. What I am missing here. </p>
  
  <p>I have tried <code>List&lt;XmlNode&gt;</code> , it is throwing error <em>System.ArgumentNullException: 'Value cannot be null. Parameter name: source'</em></p>
  
  <pre><code>class Program
      {
          static void Main(string[] args)
          {
              //Import XMl 
              // XmlNode list as name NEW
  
              foreach(XmlNode emp in NEW)
              {
                  if (emp != null)
                  {
                      AddNewList(emp);
                  }
  
              }
          } 
  
          public static void AddNewList(XmlNode emp)
          {
              //Checking for some tag 
              if(tag!=null)
              {
                  // It is throwing error 
                  currentList.Append(emp);
              }
          }
  
          public XmlNodeList currentList = null;
          public XmlNodeList previousList = null;
      }
  }
  </code></pre>