title: C# Sharepoiint 2010 - How to rename title and description of list or document library
body: <p>I would like change the title (Name) and the description of an existing lists or document Library in more SiteCollection SharePoint. I would like that the name of the list or document library take the name of the site collection.</p>
  
  <p>I create a method for change this but i've an error (</p>
  
  <p>My method :</p>
  
  <pre><code>private void RenameLists(SPWeb web)
     {
         this.ExecuteUpgrade(web, () =&gt;
          {
              SPList documentsLibraryList = web.Lists.TryGetList(documentLists.GetDocumentsLibraryName(web));
  
              if (documentsLibraryList.Title.ToString() == "Document Library")                
              {
                  string oldValue = "Document Library";
                  string newValue = (web.Title + " Documents").ToString();
                  documentsLibraryList.Title.Replace(oldValue, newValue);
                  documentsLibraryList.Update();
              }
          });
     }  
  </code></pre>
  
  <p>For my method "GetDocumentsLibraryName" :</p>
  
  <pre><code>   public static string GetDocumentsLibraryName(SPWeb web)
      {
          return string.Format("{0} Documents", web.Title);
      }
  </code></pre>
  
  <p>But when i debugg, i've an error :</p>
  
  <p><em>Message : Object reference not set to an instance of an object</em></p>
  
  <p>Any idea ? </p>
  
  <p>Best regards,</p>