You could use a StringBuilder instead of the String.Format. That way you can assert whether or not the value of Iteration is Null or Empty.
public void GetProjectInfo(string projectname,string Iteration)
{
var querystring = new StringBuilder("select [System.Id], [System.Title],[Story.Author],[Story.Owner],[System.AssignedTo],[System.WorkItemType],[Microsoft.VSTS.Scheduling.StoryPoints],[Microsoft.VSTS.Common.Priority],[Microsoft.VSTS.Scheduling.Effort], [Actual.Effort.Completed],[System.State],[System.IterationPath] FROM WorkItemLinks WHERE ");
querystring.AppendFormat("([Source].[System.TeamProject]='{0}' and [Source].[System.WorkitemType] IN ('Feature', 'Bug', 'Product Backlog Item','Task') ", projectname);
if (!string.IsNullOrEmpty(Iteration)){
querystring.AppendFormat("AND [Source].[System.IterationPath] IN ('{1}')) ", Iteration);
}
querystring.Append(" AND ([System.Links.LinkType]='System.LinkTypes.Hierarchy-Forward') ORDER BY [System.Id] mode (Recursive)");
}