/// <summary> /// Gets the specified part of the element, if any. /// </summary> public ServicePart?GetPart(ServicePartKind kind) => m_parts.FirstOrDefault(x => x.Kind == kind);
/// <summary> /// Creates an instance. /// </summary> public ServicePart(ServicePartKind kind, ServiceDefinitionPosition position, ServiceDefinitionPosition endPosition = null) { Kind = kind; Position = position; EndPosition = endPosition ?? position; }
public ServicePart GetPart <T>(ServicePartKind kind, Positioned <T> positioned) => new ServicePart(kind, GetPosition(positioned.Position), GetPosition(positioned.Position.WithNextIndex(positioned.Length)));