• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Collection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Collection的典型用法代码示例。如果您正苦于以下问题:C# Collection类的具体用法?C# Collection怎么用?C# Collection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Collection类属于命名空间,在下文中一共展示了Collection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConnectControlViewModel_AddNewServer_ResourceRepositoryReturnExistingServers_False

 public void ConnectControlViewModel_AddNewServer_ResourceRepositoryReturnExistingServers_False()
 {
     //------------Setup for test--------------------------
     var mainViewModel = new Mock<IMainViewModel>();
     var connectControlSingleton = new Mock<IConnectControlSingleton>();
     var env1 = new TestEnvironmentModel(new Mock<IEventAggregator>().Object, Guid.NewGuid(), CreateConnection(true, false).Object, new Mock<IResourceRepository>().Object, false);
     var env2 = new TestEnvironmentModel(new Mock<IEventAggregator>().Object, Guid.NewGuid(), CreateConnection(true, false).Object, new Mock<IResourceRepository>().Object, false);
     var connectControlEnvironments = new ObservableCollection<IConnectControlEnvironment>();
     var controEnv1 = new Mock<IConnectControlEnvironment>();
     var controEnv2 = new Mock<IConnectControlEnvironment>();
     controEnv1.Setup(c => c.EnvironmentModel).Returns(env1);
     controEnv2.Setup(c => c.EnvironmentModel).Returns(env2);
     controEnv1.Setup(c => c.IsConnected).Returns(true);
     connectControlEnvironments.Add(controEnv2.Object);
     connectControlEnvironments.Add(controEnv1.Object);
     connectControlSingleton.Setup(c => c.Servers).Returns(connectControlEnvironments);
     var environmentRepository = new Mock<IEnvironmentRepository>();
     ICollection<IEnvironmentModel> environments = new Collection<IEnvironmentModel>
         {
             env1
         };
     environmentRepository.Setup(e => e.All()).Returns(environments);
     var viewModel = new ConnectControlViewModel(mainViewModel.Object, environmentRepository.Object, e => { }, connectControlSingleton.Object, "TEST : ", false);
     //------------Execution-------------------------------
     int serverIndex;
     var didAddNew = viewModel.AddNewServer(out serverIndex, i => { });
     //------------Assert----------------------------------
     Assert.IsNotNull(viewModel);
     Assert.IsFalse(didAddNew);
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:30,代码来源:ConnectControlViewModelTests.cs


示例2: Table_Should_Contain_GroupFooter

		public void Table_Should_Contain_GroupFooter()
		{
			ICSharpCode.Reports.Core.BaseTableItem table = CreateContainer();
			//GroupFooter
			var c =  new Collection<ICSharpCode.Reports.Core.GroupFooter>(table.Items.OfType<ICSharpCode.Reports.Core.GroupFooter>().ToList());
			Assert.That(c.Count,Is.GreaterThanOrEqualTo(1));
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:7,代码来源:GenerateTableWithGrouping.cs


示例3: TryValidateEntity

		/// <summary>
		///     Validates a Entity
		/// </summary>
		/// <exception cref="ValidationException"></exception>
		public Tuple<bool, ICollection<ValidationResult>> TryValidateEntity(object instance)
		{
			var context = new ValidationContext(instance);
			var result = new Collection<ValidationResult>();
			var success = Validator.TryValidateObject(instance, context, result);
			return new Tuple<bool, ICollection<ValidationResult>>(success, result);
		}
开发者ID:JPVenson,项目名称:DataAccess,代码行数:11,代码来源:DbAccessLayerValidation.cs


示例4: CompileTest

		public void CompileTest()
		{
			var messages = new Collection<Tuple<string, int>>
			{
				new Tuple<string, int>("aaaaa", 200),
				new Tuple<string, int>("bbbbb", 200),
				new Tuple<string, int>("ccccc", 200),
				new Tuple<string, int>("ddddd", 200),
				new Tuple<string, int>("eeeee", 700),
				new Tuple<string, int>("fffff", 5000),
				new Tuple<string, int>("ggggg", 10000),
				new Tuple<string, int>("hhhhh", 100)
			};

			//using (var compiler = new ReentrantTask<string, bool>(500, Execute))
			//{
			//	foreach (var message in messages)
			//	{
			//		Thread.Sleep(message.Item2);
			//		compiler.StartNew(message.Item1);
			//	}
			//}

			Assert.Inconclusive();
		}
开发者ID:toolmagic,项目名称:RepeatableTask,代码行数:25,代码来源:CompileTaskTestSuite.cs


示例5: TaskList

 public TaskList()
 {
     PartitionKey = string.Empty;
     RowKey = string.Empty;
     Notes = new Collection<Note>();
     Share = new Collection<User>();
 }
开发者ID:luismdcp,项目名称:PROMPT11-10-CloudComputing,代码行数:7,代码来源:TaskList.cs


示例6: environmentTypes_Serialisation

        public void environmentTypes_Serialisation()
        {
            environmentType environmentType1;

            using (FileStream xmlStream = File.OpenRead(environmentXmlFile))
            {
                environmentType1 = SerialiserFactory.GetXmlSerialiser<environmentType>().Deserialise(xmlStream);
            }

            Assert.AreEqual(environmentType1.sessionToken, "2e5dd3ca282fc8ddb3d08dcacc407e8a", true, "Session token does not match.");

            environmentType environmentType2;

            using (FileStream xmlStream = File.OpenRead(environmentXmlFile))
            {
                environmentType2 = SerialiserFactory.GetXmlSerialiser<environmentType>().Deserialise(xmlStream);
            }

            Assert.AreEqual(environmentType2.sessionToken, "2e5dd3ca282fc8ddb3d08dcacc407e8a", true, "Session token does not match.");

            ICollection<environmentType> environmentTypes = new Collection<environmentType>
            {
                environmentType1,
                environmentType2
            };

            string xmlString = SerialiserFactory.GetXmlSerialiser<Collection<environmentType>>(new XmlRootAttribute("environments")).Serialise((Collection<environmentType>)environmentTypes);
            System.Console.WriteLine(xmlString);

            environmentTypes = SerialiserFactory.GetXmlSerialiser<Collection<environmentType>>(new XmlRootAttribute("environments")).Deserialise(xmlString);
            System.Console.WriteLine("Number deserialised is " + environmentTypes.Count);
        }
开发者ID:renier-venter,项目名称:Sif3Framework-dotNet,代码行数:32,代码来源:SerialisationUtilsTest.cs


示例7: GetSelectedValues

        private Collection<string> GetSelectedValues()
        {
            string selectedValues = this.selectedValuesHidden.Value;

            //Check if something was selected.
            if (string.IsNullOrWhiteSpace(selectedValues))
            {
                return new Collection<string>();
            }

            //Create a collection object to store the IDs.
            Collection<string> values = new Collection<string>();

            //Iterate through each value in the selected values
            //and determine if each value is a number.
            foreach (string value in selectedValues.Split(','))
            {
                //Parse the value to integer.
                int val = Conversion.TryCastInteger(value);

                if (val > 0)
                {
                    values.Add(value);
                }
            }

            return values;
        }
开发者ID:JonathanValle,项目名称:mixerp,代码行数:28,代码来源:SelectedValues.cs


示例8: GetMenuCollection

        public static Collection<MixERP.Net.Common.Models.Core.Menu> GetMenuCollection(int parentMenuId, short level)
        {
            Collection<MixERP.Net.Common.Models.Core.Menu> collection = new Collection<Common.Models.Core.Menu>();

            int userId = MixERP.Net.BusinessLayer.Helpers.SessionHelper.GetUserId();
            int officeId = MixERP.Net.BusinessLayer.Helpers.SessionHelper.GetOfficeId();
            string culture = MixERP.Net.BusinessLayer.Helpers.SessionHelper.GetCulture().TwoLetterISOLanguageName;

            using (DataTable table = MixERP.Net.DatabaseLayer.Core.Menu.GetMenuTable(parentMenuId, level, userId, officeId, culture))
            {
                if (table == null)
                {
                    return null;
                }

                foreach (DataRow row in table.Rows)
                {
                    MixERP.Net.Common.Models.Core.Menu model = new Common.Models.Core.Menu();

                    model.MenuId = Conversion.TryCastInteger(row["menu_id"]);
                    model.MenuText = Conversion.TryCastString(row["menu_text"]);
                    model.Url = Conversion.ResolveUrl(Conversion.TryCastString(row["url"]));
                    model.MenuCode = Conversion.TryCastString(row["menu_code"]);
                    model.Level = Conversion.TryCastInteger(row["level"]);
                    model.ParentMenuId = Conversion.TryCastInteger(row["parent_menu_id"]);

                    collection.Add(model);
                }
            }

            return collection;
        }
开发者ID:n4gava,项目名称:mixerp,代码行数:32,代码来源:Menu.cs


示例9: ObjectCommentRepository

        /// <summary>
        /// Default constructur
        /// </summary>
        public ObjectCommentRepository()
        {
            _comments = new Collection<CommentEntity>();

            Random rand = new Random();
            for (long i = 1; i < Repository.UserPostRepositoryInstance.GetCount(); i++)
            {
                // random count of comments for post
                for (int j = 1; j < rand.Next(1, 100); j++)
                {
                    if (Repository.UserPostRepositoryInstance.IsExists(i))
                    {
                        CommentEntity comment = new CommentEntity();
                        comment.Id = identityIdCounter++;
                        comment.CreatedUTC = DateTime.Now;
                        comment.PostId = i;
                        comment.UserId = Repository.UserPostRepositoryInstance.Get(i).AuthorUserId;
                        comment.Message = "";
                        for (int k = 0; k < rand.Next(1, 10); k++)
                            comment.Message += "Nice post!";

                        _comments.Add(comment);
                    }
                }
            }
        }
开发者ID:wishlist2012,项目名称:WishList,代码行数:29,代码来源:ObjectCommentRepository.cs


示例10: CalculateBolingerBand

 public CalculateBolingerBand(Collection<StockData> UpperBolinger, Collection<StockData> LowerBolinger, Collection<DataClass> priceList , Collection<StockData> movingAvrage)
 {
     this.UpperBolinger = UpperBolinger;
     this.LowerBolinger = LowerBolinger;
     this.priceList = priceList;
     this.movingAvrage = movingAvrage;
 }
开发者ID:JoelNordh,项目名称:StockApplication,代码行数:7,代码来源:CalculateBolingerBand.cs


示例11: CreatureSpawns

        public string CreatureSpawns()
        {
            if (!_stuffing.Objects.Any(wowObject => wowObject.Value.Type == ObjectType.Unit))
                return string.Empty;

            var units = _stuffing.Objects.Where(x => x.Value.Type == ObjectType.Unit);

            const string tableName = "creature";

            ICollection<Tuple<uint, uint>> keys = new Collection<Tuple<uint, uint>>();
            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var unit in units)
            {
                var row = new QueryBuilder.SQLInsertRow();

                var creature = unit.Value;

                if (Settings.AreaFilters.Length > 0)
                    if (!(creature.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters)))
                        continue;

                // If our unit got any of the folowing updated fields set,
                // it's probably a temporary spawn
                UpdateField uf;
                creature.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(UnitField.UNIT_FIELD_SUMMONEDBY), out uf);
                creature.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(UnitField.UNIT_CREATED_BY_SPELL), out uf);
                creature.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(UnitField.UNIT_FIELD_CREATEDBY), out uf);
                var temporarySpawn = (uf != null && uf.Int32Value != 0);
                row.CommentOut = temporarySpawn;

                // If map is Eastern Kingdoms, Kalimdor, Outland, Northrend or Ebon Hold use a lower respawn time
                // TODO: Rank and if npc is needed for quest kill should change spawntime as well
                var spawnTimeSecs = (unit.Value.Map == 0 || unit.Value.Map == 1 || unit.Value.Map == 530 ||
                                     unit.Value.Map == 571 || unit.Value.Map == 609) ? 120 : 7200;
                var movementType = 0; // TODO: Find a way to check if our unit got random movement
                var spawnDist = (movementType == 1) ? 5 : 0;

                row.AddValue("guid", unit.Key.GetLow());
                row.AddValue("id", unit.Key.GetEntry());
                row.AddValue("map", creature.Map);
                row.AddValue("spawnMask", 1);
                row.AddValue("phaseMask", creature.PhaseMask);
                row.AddValue("position_x", creature.Movement.Position.X);
                row.AddValue("position_y", creature.Movement.Position.Y);
                row.AddValue("position_z", creature.Movement.Position.Z);
                row.AddValue("orientation", creature.Movement.Orientation);
                row.AddValue("spawntimesecs", spawnTimeSecs);
                row.AddValue("spawndist", spawnDist);
                row.AddValue("MovementType", movementType);
                row.Comment = StoreGetters.GetName(StoreNameType.Unit, (int) unit.Key.GetEntry(), false);
                row.Comment += " (Area: " + StoreGetters.GetName(StoreNameType.Area, creature.Area, false) + ")";
                if (temporarySpawn)
                    row.Comment += " - !!! might be temporary spawn !!!";

                rows.Add(row);
                keys.Add(new Tuple<uint, uint>((uint) unit.Key.GetLow(), unit.Key.GetEntry()));
            }

            return new QueryBuilder.SQLInsert(tableName, keys, new[] { "guid", "id" }, rows).Build();
        }
开发者ID:LegacyCorporation,项目名称:LegacyPacketParser,代码行数:60,代码来源:Builder.cs


示例12: BindParameters

 internal override Collection<CommandParameterInternal> BindParameters(Collection<CommandParameterInternal> arguments)
 {
     Collection<CommandParameterInternal> collection = new Collection<CommandParameterInternal>();
     foreach (CommandParameterInternal internal2 in arguments)
     {
         if (!internal2.ParameterNameSpecified)
         {
             collection.Add(internal2);
         }
         else
         {
             MergedCompiledCommandParameter parameter = base.BindableParameters.GetMatchingParameter(internal2.ParameterName, false, true, new InvocationInfo(base.InvocationInfo.MyCommand, internal2.ParameterExtent));
             if (parameter != null)
             {
                 if (base.BoundParameters.ContainsKey(parameter.Parameter.Name))
                 {
                     ParameterBindingException exception = new ParameterBindingException(ErrorCategory.InvalidArgument, base.InvocationInfo, base.GetParameterErrorExtent(internal2), internal2.ParameterName, null, null, "ParameterBinderStrings", "ParameterAlreadyBound", new object[0]);
                     throw exception;
                 }
                 this.BindParameter(int.MaxValue, internal2, parameter, ParameterBindingFlags.ShouldCoerceType);
             }
             else if (internal2.ParameterName.Equals("-%", StringComparison.Ordinal))
             {
                 base.DefaultParameterBinder.CommandLineParameters.SetImplicitUsingParameters(internal2.ArgumentValue);
             }
             else
             {
                 collection.Add(internal2);
             }
         }
     }
     return collection;
 }
开发者ID:nickchal,项目名称:pash,代码行数:33,代码来源:ScriptParameterBinderController.cs


示例13: GetParameters

        public static Collection<KeyValuePair<string, string>> GetParameters(string reportPath)
        {
            if(!File.Exists(reportPath))
            {
                return null;
            }

            Collection<KeyValuePair<string, string>> parameterCollection = new Collection<KeyValuePair<string, string>>();
            XmlNodeList dataSources = XmlHelper.GetNodes(reportPath, "//DataSource");

            foreach(XmlNode datasource in dataSources)
            {
                foreach(XmlNode parameters in datasource.ChildNodes)
                {
                    if(parameters.Name.Equals("Parameters"))
                    {
                        foreach(XmlNode parameter in parameters.ChildNodes)
                        {
                            if(parameter.Attributes != null && !KeyExists(parameter.Attributes["Name"].Value, parameterCollection))
                            {
                                parameterCollection.Add(new KeyValuePair<string, string>(parameter.Attributes["Name"].Value, parameter.Attributes["Type"].Value));
                            }
                        }
                    }
                }
            }

            return parameterCollection;
        }
开发者ID:kevinhuo88888,项目名称:mixerp,代码行数:29,代码来源:ParameterHelper.cs


示例14: ExploreRouteControllers

        private void ExploreRouteControllers(IDictionary<string, HttpControllerDescriptor> controllerMappings, IHttpRoute route, Collection<ApiDescription> apiDescriptions)
        {
            string routeTemplate = route.RouteTemplate;
            object controllerVariableValue;
            if (_controllerVariableRegex.IsMatch(routeTemplate))
            {
                // unbound controller variable, {controller}
                foreach (KeyValuePair<string, HttpControllerDescriptor> controllerMapping in controllerMappings)
                {
                    controllerVariableValue = controllerMapping.Key;
                    HttpControllerDescriptor controllerDescriptor = controllerMapping.Value;

                    if (DefaultExplorer.ShouldExploreController(controllerVariableValue.ToString(), controllerDescriptor, route))
                    {
                        // expand {controller} variable
                        string expandedRouteTemplate = _controllerVariableRegex.Replace(routeTemplate, controllerVariableValue.ToString());
                        ExploreRouteActions(route, expandedRouteTemplate, controllerDescriptor, apiDescriptions);
                    }
                }
            }
            else
            {
                // bound controller variable, {controller = "controllerName"}
                if (route.Defaults.TryGetValue(ControllerVariableName, out controllerVariableValue))
                {
                    HttpControllerDescriptor controllerDescriptor;
                    if (controllerMappings.TryGetValue(controllerVariableValue.ToString(), out controllerDescriptor) && DefaultExplorer.ShouldExploreController(controllerVariableValue.ToString(), controllerDescriptor, route))
                    {
                        ExploreRouteActions(route, routeTemplate, controllerDescriptor, apiDescriptions);
                    }
                }
            }
        }
开发者ID:davidsavagejr,项目名称:SDammann.WebApi.Versioning,代码行数:33,代码来源:VersionedApiExplorer.cs


示例15: GetFilesToRename_WithValidFiles_ReturnsFileMetaDatasForMatchingFiles

        public void GetFilesToRename_WithValidFiles_ReturnsFileMetaDatasForMatchingFiles()
        {
            // Assert
            var fileNames = new List<string>
            {
                @".\Resources\2013_05_10_00_00_00.pdf",
                @"Resources\2014_06_10_15_10_58.pdf",
                @"Resources\2013_05_01.pdf"
            };

            var pdfInfos = new Collection<PdfInfo>
            {
                new PdfInfo("My Bank", @"C:\Temp", "mybank.com",
                    @"\d{1,2}(?:st|nd|rd|th)\s[A-Z,a-z]{3}\s20\d{2}\sto\s(?<day>\d{1,2})(?:st|nd|rd|th)\s(?<month>[A-Z,a-z]{3})\s(?<year>20\d{2})"),
                new PdfInfo("Bank2 Credit Card", @"C:\Temp", "67904567",
                    @"Statement:\s\d{1,2}\s[A-Z,a-z]+?\sto\s(?<day>\d{1,2})\s(?<month>[A-Z,a-z]{3})[a-z]*\s(?<year>20\d{2})")
            };

            // Act
            List<FileMetaData> filesToRename = PdfParser.GetFilesToRename(fileNames, pdfInfos).ToList();

            // Assert
            Assert.That(filesToRename.Count, Is.EqualTo(2), "filesToRename.Count");
            Assert.That(filesToRename[0].OldPath, Is.EqualTo(@".\Resources\2013_05_10_00_00_00.pdf"), "filesToRename[0].OldPath");
            Assert.That(filesToRename[0].NewPath, Is.EqualTo(@"C:\Temp\My Bank 2013_05_10.pdf"),
                "filesToRename[0].NewPath");
            Assert.That(filesToRename[0].Date, Is.EqualTo(new DateTime(2013, 5, 10)), "filesToRename[0].Date");
        }
开发者ID:openshac,项目名称:PdfFiler,代码行数:28,代码来源:PdfParserTests.cs


示例16: AddGeometries

		public static void AddGeometries(WpfHexView hexView, Collection<VSTF.TextBounds> textBounds, bool isLineGeometry, bool clipToViewport, Thickness padding, double minWidth, ref PathGeometry geo, ref bool createOutlinedPath) {
			foreach (var bounds in textBounds) {
				double left = bounds.Left - padding.Left;
				double right = bounds.Right + padding.Right;
				double top, bottom;
				if (isLineGeometry) {
					top = bounds.Top - padding.Top;
					bottom = bounds.Bottom + padding.Bottom;
				}
				else {
					top = bounds.TextTop - padding.Top;
					bottom = bounds.TextBottom + padding.Bottom;
				}
				if (right - left < minWidth)
					right = left + minWidth;
				if (clipToViewport) {
					left = Math.Max(left, hexView.ViewportLeft);
					right = Math.Min(right, hexView.ViewportRight);
				}
				if (right <= left || bottom <= top)
					continue;
				const double MAX_HEIGHT = 1000000;
				const double MAX_WIDTH = 1000000;
				double width = Math.Min(right - left, MAX_WIDTH);
				double height = Math.Min(bottom - top, MAX_HEIGHT);

				if (geo == null)
					geo = new PathGeometry { FillRule = FillRule.Nonzero };
				else
					createOutlinedPath = true;
				geo.AddGeometry(new RectangleGeometry(new Rect(left, top, width, height)));
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:33,代码来源:HexMarkerHelper.cs


示例17: SubjectBuffersConnected

        public void SubjectBuffersConnected(IWpfTextView textView, ConnectionReason reason, Collection<ITextBuffer> subjectBuffers)
        {
            if (reason != ConnectionReason.TextViewLifetime)
                return;

            instants.Add (textView, new InstantVisualStudio (textView, this.documentService));
        }
开发者ID:ermau,项目名称:Instant,代码行数:7,代码来源:InstantVisualStudioFactory.cs


示例18: Usuario

        public Usuario()
        {
            Asistencias = new Collection<Asistencia>();
            Tareas = new Collection<Tareas>();
            Visitas = new Collection<Visita>();

        }
开发者ID:eva277,项目名称:CodeFirstPractica1,代码行数:7,代码来源:1454501276$usuario.cs


示例19: HelpPageApiModel

 /// <summary>
 /// Initializes a new instance of the <see cref="HelpPageApiModel"/> class.
 /// </summary>
 public HelpPageApiModel()
 {
     SampleRequests = new Dictionary<MediaTypeHeaderValue, object>();
     SampleResponses = new Dictionary<MediaTypeHeaderValue, object>();
     ErrorMessages = new Collection<string>();
     ErrorCodes = new Collection<HelpPageErrorCode>();
 }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:10,代码来源:HelpPageApiModel.cs


示例20: ProcessRecord

 protected override void ProcessRecord()
 {
     ProviderInfo provider = null;
     Collection<string> resolvedProviderPathFromPSPath;
     try
     {
         if (base.Context.EngineSessionState.IsProviderLoaded(base.Context.ProviderNames.FileSystem))
         {
             resolvedProviderPathFromPSPath = base.SessionState.Path.GetResolvedProviderPathFromPSPath(this._path, out provider);
         }
         else
         {
             resolvedProviderPathFromPSPath = new Collection<string> {
                 this._path
             };
         }
     }
     catch (ItemNotFoundException)
     {
         FileNotFoundException exception = new FileNotFoundException(StringUtil.Format(Modules.ModuleNotFound, this._path));
         ErrorRecord errorRecord = new ErrorRecord(exception, "Modules_ModuleNotFound", ErrorCategory.ResourceUnavailable, this._path);
         base.WriteError(errorRecord);
         return;
     }
     if (!provider.NameEquals(base.Context.ProviderNames.FileSystem))
     {
         throw InterpreterError.NewInterpreterException(this._path, typeof(RuntimeException), null, "FileOpenError", ParserStrings.FileOpenError, new object[] { provider.FullName });
     }
     if ((resolvedProviderPathFromPSPath != null) && (resolvedProviderPathFromPSPath.Count >= 1))
     {
         if (resolvedProviderPathFromPSPath.Count > 1)
         {
             throw InterpreterError.NewInterpreterException(resolvedProviderPathFromPSPath, typeof(RuntimeException), null, "AmbiguousPath", ParserStrings.AmbiguousPath, new object[0]);
         }
         string path = resolvedProviderPathFromPSPath[0];
         ExternalScriptInfo scriptInfo = null;
         if (System.IO.Path.GetExtension(path).Equals(".psd1", StringComparison.OrdinalIgnoreCase))
         {
             string str5;
             scriptInfo = base.GetScriptInfoForFile(path, out str5, false);
             PSModuleInfo sendToPipeline = base.LoadModuleManifest(scriptInfo, ModuleCmdletBase.ManifestProcessingFlags.WriteWarnings | ModuleCmdletBase.ManifestProcessingFlags.WriteErrors, null, null);
             if (sendToPipeline != null)
             {
                 base.WriteObject(sendToPipeline);
             }
         }
         else
         {
             InvalidOperationException exception3 = new InvalidOperationException(StringUtil.Format(Modules.InvalidModuleManifestPath, path));
             ErrorRecord record3 = new ErrorRecord(exception3, "Modules_InvalidModuleManifestPath", ErrorCategory.InvalidArgument, this._path);
             base.ThrowTerminatingError(record3);
         }
     }
     else
     {
         FileNotFoundException exception2 = new FileNotFoundException(StringUtil.Format(Modules.ModuleNotFound, this._path));
         ErrorRecord record2 = new ErrorRecord(exception2, "Modules_ModuleNotFound", ErrorCategory.ResourceUnavailable, this._path);
         base.WriteError(record2);
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:60,代码来源:TestModuleManifestCommand.cs



注:本文中的Collection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CollectionAccessType类代码示例发布时间:2022-05-24
下一篇:
C# CollSeq类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap