BuildingCoder.RevitCommand.GetPhaseId C# (CSharp) Method

GetPhaseId() public method

public GetPhaseId ( string phaseName, Document doc ) : ElementId
phaseName string
doc Document
return ElementId
        public ElementId GetPhaseId(
            string phaseName,
            Document doc)
        {
            ElementId id = null;

              FilteredElementCollector collector
            = new FilteredElementCollector( doc );

              collector.OfClass( typeof( Phase ) );

              var phases = from Phase phase in collector
                   where phase.Name.Equals( phaseName )
                   select phase;

              id = phases.First().Id;

              return id;
        }