Microsoft.DocAsCode.Build.Engine.TemplateProcessor.TryGetFileExtension C# (CSharp) Method

TryGetFileExtension() public method

public TryGetFileExtension ( string documentType, string &fileExtension ) : bool
documentType string
fileExtension string
return bool
        public bool TryGetFileExtension(string documentType, out string fileExtension)
        {
            if (string.IsNullOrEmpty(documentType)) throw new ArgumentNullException(nameof(documentType));
            fileExtension = string.Empty;
            if (_templateCollection.Count == 0) return false;
            var templateBundle = _templateCollection[documentType];

            // Get default template extension
            if (templateBundle == null) return false;

            fileExtension = templateBundle.Extension;
            return true;
        }