/// <summary> /// Initializes a new instance of the <see cref="SharedSourceFiles"/> class. /// </summary> /// <param name="sourceFileLocationService">Service to use to locate source files for types or methods. /// It cannot be null.</param> /// <param name="filenameMap">Cache to map file names to an internal ID and back.</param> /// <param name="sharedFiles">The set of files to consider "shared" in answering requests about types or methods. /// It may be empty but it cannot be null.</param> internal SharedSourceFiles(ISourceFileLocationService sourceFileLocationService, FilenameMap filenameMap, IEnumerable <string> sharedFiles) { System.Diagnostics.Debug.Assert(sourceFileLocationService != null, "sourceFileLocationService cannot be null"); System.Diagnostics.Debug.Assert(filenameMap != null, "filenameMap cannot be null"); System.Diagnostics.Debug.Assert(sharedFiles != null, "sharedFiles cannot be null"); this._sourceFileLocationService = sourceFileLocationService; this._filenameMap = filenameMap; this._anySharedFiles = sharedFiles.Any(); // Don't allocate anything if the list of files is empty if (this._anySharedFiles) { // Get a unique ID for every file declared as shared, and // keep this in a hashset for fast lookup foreach (string sharedFile in sharedFiles) { this._sharedFileIds.Add(this._filenameMap.AddOrGet(sharedFile)); } } }
/// <summary> /// Initializes a new instance of the <see cref="SharedSourceFiles"/> class. /// </summary> /// <param name="sourceFileLocationService">Service to use to locate source files for types or methods. /// It cannot be null.</param> /// <param name="filenameMap">Cache to map file names to an internal ID and back.</param> /// <param name="sharedFiles">The set of files to consider "shared" in answering requests about types or methods. /// It may be empty but it cannot be null.</param> internal SharedSourceFiles(ISourceFileLocationService sourceFileLocationService, FilenameMap filenameMap, IEnumerable<string> sharedFiles) { System.Diagnostics.Debug.Assert(sourceFileLocationService != null, "sourceFileLocationService cannot be null"); System.Diagnostics.Debug.Assert(filenameMap != null, "filenameMap cannot be null"); System.Diagnostics.Debug.Assert(sharedFiles != null, "sharedFiles cannot be null"); this._sourceFileLocationService = sourceFileLocationService; this._filenameMap = filenameMap; this._anySharedFiles = sharedFiles.Any(); // Don't allocate anything if the list of files is empty if (this._anySharedFiles) { // Get a unique ID for every file declared as shared, and // keep this in a hashset for fast lookup foreach (string sharedFile in sharedFiles) { this._sharedFileIds.Add(this._filenameMap.AddOrGet(sharedFile)); } } }