当前位置: 首页>>代码示例>>C#>>正文


C# IEnumerable.?.ToArray方法代码示例

本文整理汇总了C#中IEnumerable.?.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# IEnumerable.?.ToArray方法的具体用法?C# IEnumerable.?.ToArray怎么用?C# IEnumerable.?.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEnumerable的用法示例。


在下文中一共展示了IEnumerable.?.ToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAvailabilityFromNow

        public IDictionary<string, double> GetAvailabilityFromNow(WorksheetEntry worksheet, IEnumerable<string> professionals = null)
        {
            var sectionLines = GetSectionLinesPosition(worksheet, "Disponibilidade de horas por profissional e dia");
            var minLine = sectionLines.Select(sl => sl.Value).Min();
            var maxLine = sectionLines.Select(sl => sl.Value).Max();
            var today = DateTime.Now.ToShortDateString();
            var dateLines = _spreadsheetFacade.GetCellsValues(worksheet, minLine - 1, minLine, 1, uint.MaxValue).ToList();
            var colNow = dateLines.First(dl => dl.Value.Equals(today)).Column;
            var result = new Dictionary<string, double>();

            for (var i = minLine; i <= maxLine; i++)
            {
                var i1 = i;
                var professional = sectionLines.Where(sl => sl.Value == i1).Select(sl => sl.Key).First().ToLower();
                var enumerableProfessionals = professionals?.ToArray() ?? new string[0];

                if (!enumerableProfessionals.Any() || enumerableProfessionals.Any(ep => ep.ToLower().Contains(professional) || professional.Contains(ep.ToLower())))
                {
                    var availability = _spreadsheetFacade.GetCellsValues(worksheet, i, i, colNow, uint.MaxValue).Sum(c => double.Parse(c.Value));
                    result.Add(professional, availability);
                }
            }

            return result;
        }
开发者ID:fortesinformatica,项目名称:CoreSprint,代码行数:25,代码来源:SprintRunningHelper.cs

示例2: ComposeEmail

        public void ComposeEmail(
            IEnumerable<string> to, IEnumerable<string> cc = null, string subject = null,
            string body = null, bool isHtml = false,
            IEnumerable<EmailAttachment> attachments = null, string dialogTitle = null)
        {
            if (!MFMailComposeViewController.CanSendMail)
                throw new MvxException("This device cannot send mail");

            _mail = new MFMailComposeViewController();
            _mail.SetMessageBody(body ?? string.Empty, isHtml);
            _mail.SetSubject(subject ?? string.Empty);

            if (cc != null)
                _mail.SetCcRecipients(cc.ToArray());

            _mail.SetToRecipients(to?.ToArray() ?? new[] { string.Empty });
            if (attachments != null)
            {
                foreach (var a in attachments)
                {
                    _mail.AddAttachmentData(NSData.FromStream(a.Content), a.ContentType, a.FileName);
                }
            }
            _mail.Finished += HandleMailFinished;

            _modalHost.PresentModalViewController(_mail, true);
        }
开发者ID:ChebMami38,项目名称:MvvmCross-Plugins,代码行数:27,代码来源:MvxComposeEmailTask.cs

示例3: ContainerRateLimit

		public ContainerRateLimit(
			ITaskParam Task,
			IEnumerable<ITaskRateLimit> SetRateLimit = null)
			:
			base(Task.Yield())
		{
			this.SetRateLimit = SetRateLimit?.ToArray();
		}
开发者ID:trainingday01,项目名称:Optimat.EveOnline,代码行数:8,代码来源:ContainerRateLimit.cs

示例4: KeyboardPressCombined

		static public MotionResult KeyboardPressCombined(
			this IHostToScript Sanderling,
			IEnumerable<VirtualKeyCode> SetKey) =>
			Sanderling?.MotionExecute(new Motor.MotionParam()
			{
				KeyDown = SetKey?.ToArray(),
				KeyUp = SetKey?.Reverse()?.ToArray(),
			});
开发者ID:grachevko,项目名称:Sanderling,代码行数:8,代码来源:ToScriptExtension.cs

示例5: PipPackageManager

        public PipPackageManager(
            bool allowFileSystemWatchers = true,
            IEnumerable<string> extraInterpreterArgs = null
        ) {
            _packages = new List<PackageSpec>();
            _extraInterpreterArgs = extraInterpreterArgs?.ToArray() ?? Array.Empty<string>();

            if (allowFileSystemWatchers) {
                _libWatchers = new List<FileSystemWatcher>();
                _refreshIsCurrentTrigger = new Timer(RefreshIsCurrentTimer_Elapsed);
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:12,代码来源:PipPackageManager.cs

示例6: SerializerOptions

        public SerializerOptions(bool versionTolerance = false, IEnumerable<Surrogate> surrogates = null,
            bool preserveObjectReferences = false, IEnumerable<ValueSerializerFactory> serializerFactories = null)
        {
            VersionTolerance = versionTolerance;
            Surrogates = surrogates?.ToArray() ?? EmptySurrogates;

            //use the default factories + any user defined
            ValueSerializerFactories =
                DefaultValueSerializerFactories.Concat(serializerFactories?.ToArray() ?? EmptyValueSerializerFactories)
                    .ToArray();

            PreserveObjectReferences = preserveObjectReferences;
        }
开发者ID:philiplaureano,项目名称:Wire,代码行数:13,代码来源:SerializerOptions.cs

示例7: VplServiceContext

        public VplServiceContext(IEnumerable<IVplPlugin> plugins = null)
        {
            _plugins = plugins?.ToArray() ?? new IVplPlugin[] {};

            _customResources = _plugins.SelectMany(p => p.Resources);

            var customFactories = _plugins.SelectMany(p => p.ElementFactories);

            _elementFactoryManager = new ElementFactoryManager(customFactories);

            //These are the "built-in" types
            var types = new List<IVplType>
            {
                new VplType(VplTypeId.Boolean, "Boolean", () => new BooleanValueCheckBoxView(), false, typeof(bool)),
                new VplType(VplTypeId.Float, "Float", () => new DoubleValueView(), 0.0, typeof(double)),
                new VplType(VplTypeId.Any, "Any", () => new TextValueView(), null, typeof(object)),
                new VplType(VplTypeId.String, "String", () => new TextValueView(), "", typeof(string)),
                new VplType(VplTypeId.Int, "Int", () => new Int32ValueView(), 0, typeof(int)),
                new VplType(VplTypeId.Byte, "Byte", () => new ByteValueView(), (byte)0, typeof(byte)),
                new VplType(VplTypeId.UInt16, "UInt16", () => new TextValueView(), (ushort)0, typeof(ushort)),
                new VplType(VplTypeId.UInt32, "UInt32", () => new TextValueView(), (uint)0, typeof(uint)),
                new VplType(VplTypeId.Single, "Single", () => new TextValueView(), (float)0, typeof(float)),
                new VplType(VplTypeId.SByte, "Int8", () => new TextValueView(), (sbyte)0, typeof(sbyte)),
                new VplType(VplTypeId.Int16, "Int16", () => new Int16ValueView(), (short)0, typeof(short)),
                new VplType(VplTypeId.DateTime, "DateTime", () => new DateTimeValueView(), DateTime.Now, typeof(DateTime)),
                new VplType(VplTypeId.UInt64, "UInt64", () => new TextValueView(), (ulong)0, typeof(ulong)),
                new VplType(VplTypeId.Int64, "Int64", () => new TextValueView(), (long)0, typeof(long)),
                new VplType(VplTypeId.Decimal, "Decimal", () => new TextValueView(), (decimal)0, typeof(decimal))
            };

            //Add the plugin types
            foreach (var plugin in _plugins)
            {
                types.AddRange(plugin.Types);
            }

            //Create the array of types
            _types = types
                .OrderBy(t => t.Name)
                .ToArray();

            //Create the services
            _services = _plugins
                .SelectMany(p => p.Services)
                .ToArray();

            //Create an element builder
            _elementBuilder = new ElementBuilder(_elementFactoryManager, this);
        }
开发者ID:CaptiveAire,项目名称:VPL,代码行数:49,代码来源:VplServiceContext.cs

示例8: IsAuthorized

        public bool IsAuthorized(IEnumerable<SecurityGroup> securityGroups)
        {
            var authenticatedUser = GetAuthenticatedUser();

            var secGroups = securityGroups as SecurityGroup[] ?? securityGroups?.ToArray();

            if (secGroups == null || secGroups.Any())
                return false;

            foreach (var secGroup in secGroups)
                if (authenticatedUser.IsInRole(secGroup.Name))
                    return true;

            return false;
        }
开发者ID:devworker55,项目名称:SourceLab,代码行数:15,代码来源:AuthorizationManager.cs

示例9: Summarize

        public static string Summarize(IEnumerable<IDeadline> deadlines)
        {
            IEnumerable<IDeadline> deadlinesEnumerated = deadlines?.ToArray();
            if (deadlinesEnumerated == null || !deadlinesEnumerated.Any())
                return Info.NotFound;

            var sb = new StringBuilder();
            sb.Append("Крайние сроки сдачи работ:\n");
            foreach (var deadline in deadlinesEnumerated)
            {
                sb.Append(deadline);
                sb.Append('\n');
            }
            return sb.ToString();
        }
开发者ID:koxrel,项目名称:LearningAssistantBot,代码行数:15,代码来源:TextBuilder.cs

示例10: GetVolunteersForDateQueryable

        private IQueryable<Person> GetVolunteersForDateQueryable(int disasterId, DateTime date, bool checkedInOnly, IEnumerable<int> inClusterIds)
        {
            if (disasterId <= 0)
                throw new ArgumentException("disasterId must be greater than zero", "disasterId");

            var inClusterIdsArray = inClusterIds?.ToArray() ?? new int[0];
            var hasClusters = inClusterIdsArray.Length == 0;

            var people = from p in _dataService.Persons
                         join c in Commitment.FilteredByStatus(_dataService.Commitments, checkedInOnly)
                            on p.Id equals c.PersonId
                         where c.DisasterId == disasterId
                         where date >= c.StartDate && date <= c.EndDate
                         where hasClusters || inClusterIdsArray.Any(cid => cid == c.ClusterId)
                         select p;

            return people.Distinct();
        }
开发者ID:dayewah,项目名称:crisischeckin,代码行数:18,代码来源:AdminService.cs

示例11: SerializerOptions

        public SerializerOptions(bool versionTolerance = false, bool preserveObjectReferences = false, IEnumerable<Surrogate> surrogates = null, IEnumerable<ValueSerializerFactory> serializerFactories = null, IEnumerable<Type> knownTypes = null)
        {
            VersionTolerance = versionTolerance;
            Surrogates = surrogates?.ToArray() ?? EmptySurrogates;

            //use the default factories + any user defined
            ValueSerializerFactories =
                DefaultValueSerializerFactories.Concat(serializerFactories?.ToArray() ?? EmptyValueSerializerFactories)
                    .ToArray();

            KnownTypes = knownTypes?.ToArray() ?? new Type[] {};
            for (var i = 0; i < KnownTypes.Length; i++)
            {
                KnownTypesDict.Add(KnownTypes[i],(ushort)i);
            }

            PreserveObjectReferences = preserveObjectReferences;
        }
开发者ID:akkadotnet,项目名称:Wire,代码行数:18,代码来源:SerializerOptions.cs

示例12: Escape

        /// <summary>
        /// Escapes given command line arguments using windows operating system specific rules. This method assumes that the 
        /// arguments parameter is not null or empty. More information - http://stackoverflow.com/questions/5510343/escape-command-line-arguments-in-c-sharp
        /// </summary>
        /// <param name="arguments">Command line arguments.</param>
        /// <returns>Escaped command line arguments.</returns>
        public IEnumerable<string> Escape(IEnumerable<string> arguments)
        {
            var escapedArguments = new List<string>();

            var argumentsArray = arguments?.ToArray() ?? new string[] {};

            if (argumentsArray.Any())
            {
                foreach (var argument in argumentsArray)
                {
                    var escaped = Regex.Replace(argument, @"(\\*)" + "\"", @"$1\$0");
                    escaped = Regex.Replace(escaped, @"^(.*\s.*?)(\\*)$", "\"$1$2$2\"");

                    escapedArguments.Add(escaped);
                }
            }

            return escapedArguments;
        }
开发者ID:narkhedegs,项目名称:Escapist,代码行数:25,代码来源:WindowsEscapeStrategy.cs

示例13: FakeItem

        public FakeItem(
			Guid id = default(Guid), 
			string databaseName = "master", 
			Guid parentId = default(Guid), 
			string path = "/sitecore/content/test item", 
			string name = "test item", 
			Guid branchId = default(Guid), 
			Guid templateId = default(Guid), 
			IEnumerable<IItemFieldValue> sharedFields = null, 
			IEnumerable<IItemVersion> versions = null, 
			string serializedItemId = "0xDEADBEEF", 
			IEnumerable<IItemData> children = null)
            : base(name, id, parentId, templateId, path, databaseName)
        {
            BranchId = branchId;
            SharedFields = sharedFields ?? new List<IItemFieldValue>();
            Versions = versions ?? new List<IItemVersion>();
            SerializedItemId = serializedItemId;

            SetProxyChildren(children?.ToArray() ?? new IItemData[0]);
        }
开发者ID:csteeg,项目名称:Rainbow,代码行数:21,代码来源:FakeItem.cs

示例14: RuleSetInformation

        public RuleSetInformation(string projectFullName, string baselineRuleSet, string projectRuleSet, IEnumerable<string> ruleSetDirectories)
        {
            if (string.IsNullOrWhiteSpace(projectFullName))
            {
                throw new ArgumentNullException(nameof(projectFullName));
            }

            if (string.IsNullOrWhiteSpace(baselineRuleSet))
            {
                throw new ArgumentNullException(nameof(baselineRuleSet));
            }

            if (string.IsNullOrWhiteSpace(projectRuleSet))
            {
                throw new ArgumentNullException(nameof(projectRuleSet));
            }

            this.RuleSetProjectFullName = projectFullName;
            this.BaselineFilePath = baselineRuleSet;
            this.RuleSetFilePath = projectRuleSet;
            this.RuleSetDirectories = ruleSetDirectories?.ToArray() ?? new string[0];
        }
开发者ID:SonarSource-VisualStudio,项目名称:sonarlint-visualstudio,代码行数:22,代码来源:RuleSetInformation.cs

示例15: GenerateClassProxy

        private static object GenerateClassProxy(
            Type typeOfProxy,
            ProxyGenerationOptions options,
            IEnumerable<object> argumentsForConstructor,
            IInterceptor interceptor,
            IEnumerable<Type> allInterfacesToImplement)
        {
            var argumentsArray = argumentsForConstructor?.ToArray();

            return ProxyGenerator.CreateClassProxy(
                typeOfProxy,
                allInterfacesToImplement.ToArray(),
                options,
                argumentsArray,
                interceptor);
        }
开发者ID:bman61,项目名称:FakeItEasy,代码行数:16,代码来源:CastleDynamicProxyGenerator.cs


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