title: Check if the file is already in source control
body: <p>I am working with TFS programmatically using classes from <a href="http://msdn.microsoft.com/en-us/library/bb141847" rel="noreferrer">Microsoft.TeamFoundation.VersionControl.Client namespace</a>. My goal is to check-in files from the local folder into source control. Some files may already exist in SC and should be Edited, some are new and should be added, some exist in SC and haven't changed, so I don't need to do anything with them.</p>
  
  <p>My problem is that I can't figure out how to check whether a file already exists in source control, so I can't decide in my code whether I should Add or Edit it. None of the <a href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.workspace" rel="noreferrer">Workspace</a> methods seem to do what I need.</p>
  
  <p>The code I have:</p>
  
  <pre><code>foreach (string file in fileList)
  {
      workspace.PendEdit(file);
      workspace.PendAdd(file);
  }
  </code></pre>
  
  <p>It does the job, but it looks dumb and feels slow. What is the correct way to do it?</p>