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


C# List.ToArray方法代码示例

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


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

示例1: MainWindow

        public MainWindow()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            InitializeComponent();

            Uri uri = new Uri("DataTemplates.xaml", System.UriKind.Relative);
            ResourceDictionary resourceDico = (ResourceDictionary)System.Windows.Application.LoadComponent(uri);
            Resources.MergedDictionaries.Add(resourceDico);

            EditorLink.Instance.Init(this.renderControl.Handle, Resources);

            this.renderControl.Paint += new PaintEventHandler(simpleOpenGlControl_Paint);
            CompositionTargetEx.FrameUpdating += new EventHandler<RenderingEventArgs>(CompositionTargetEx_FrameUpdating);

            List<ObjectLink> entityList = new List<ObjectLink>();
            entityList.Add(EditorLink.Instance.SpawnEntity(-10.0f, 0, 0));
            entityList.Add(EditorLink.Instance.SpawnEntity(10.0f, 0, 0));

            SimpleTest[] obj = new SimpleTest[2];
            obj[0] = new SimpleTestA();
            obj[1] = new SimpleTestB();
            myPropertyGrid.SelectedObjects = entityList.ToArray();
            propertygrid2.SelectedObjects = entityList.ToArray();
               // o.PropertyChanged += new PropertyChangedEventHandler(o_PropertyChanged);
        }
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:27,代码来源:MainWindow.xaml.cs

示例2: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            string[] clubnames ={
                "AC Ajaccio",
                "AS Nancy-Lorraine" ,
                "AS Saint-Etienne",
                "ESTAC Troyes",
                "Evian TG FC",
                "FC Lorient",
                "FC Sochaux-Montbéliard",
                "Girondins de Bordeaux",
                "LOSC Lille",
                "Montpellier Hérault SC",
                "OGC Nice",
                "Olympique de Marseille",
                "Olympique Lyonnais",
                "Paris Saint-Germain",
                "SC Bastia",
                "Stade Brestois 29",
                "Stade de Reims",
                "Stade Rennais FC",
                "Toulouse FC",
                "Valenciennes FC"
            };
            List<Club> clubs = new List<Club>();

            foreach (string clubname in clubnames)
                clubs.Add(new Club(clubname));

            Ranking ranking = new Ranking(new FrenchLeague1PointSystem(), clubs.ToArray());

            this.matchEditView.DataContext = new ViewModel.MatchViewModel(clubs, ranking);
            this.rankingView.DataContext = new ViewModel.RankingViewModel(ranking);
        }
开发者ID:JeanPinatel,项目名称:TP_Labasse_DotNet,代码行数:35,代码来源:MainWindow.xaml.cs

示例3: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            var reviews = new List<Review>
            {
                new Review(){Critic = "Wesley Morris" ,LetterGrade="B",ReviewSnippet="For better and worse, it weights nothing, which is not the same as saying it means nothing."},
                new Review(){Critic ="Roger Ebert" ,LetterGrade="A-",ReviewSnippet="Like the hero of that film, the viewer of Inception is adrift in time and experience"},
                new Review(){Critic ="Michael Phillips" ,LetterGrade="B",ReviewSnippet="Nolan conjures up a fever dream."},
                //new Review(){Critic ="Joshua Flores" ,LetterGrade="B-",ReviewSnippet="Not great, interesting idea, and although the possibilities seem endless, Nolan had only proven he make use the same characters to be in 3 different action scenes at once."},
            };

            var reviews2 = new List<Review>
            {
                new Review(){Critic ="Michael Phillips" ,LetterGrade="B",ReviewSnippet="Nolan conjures up a fever dream."},
                new Review(){Critic ="Roger Ebert" ,LetterGrade="A-",ReviewSnippet="Like the hero of that film, the viewer of Inception is adrift in time and experience"},
                new Review(){Critic = "Wesley Morris" ,LetterGrade="B",ReviewSnippet="For better and worse, it weights nothing, which is not the same as saying it means nothing."},
                new Review(){Critic ="Joshua Flores" ,LetterGrade="B-",ReviewSnippet="Not great, interesting idea, and although the possibilities seem endless, Nolan had only proven he make use the same characters to be in 3 different action scenes at once."},
            };

            var templates = new ScreenSavers[] {
                new ScreenSavers(){TemplateName = "Default", Screens = reviews.ToArray()},
                new ScreenSavers(){TemplateName = "Ragnarock", Screens = reviews2.ToArray()}
            };

            Code_Flextion_TPanel.ItemsSource = templates;
        }
开发者ID:Narucross,项目名称:JFlor_Practices,代码行数:26,代码来源:MainWindow.xaml.cs

示例4: FlowDocumentToSlipPrinterFormat

 public static string[] FlowDocumentToSlipPrinterFormat(FlowDocument document)
 {
     var result = new List<string>();
     if (document != null)
         result.AddRange(ReadBlocks(document.Blocks));
     return result.ToArray();
 }
开发者ID:noromamai,项目名称:SambaPOS-3,代码行数:7,代码来源:PrinterTools.cs

示例5: GetPowerHeading

        /// <summary>
        /// Construct the heading for a power.
        /// </summary>
        /// <param name="power">
        /// The <see cref="Power"/> to consturct the 
        /// </param>
        /// <returns>
        /// The header as a string encoded for HTML.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// No argument can be null.
        /// </exception>
        public string GetPowerHeading(Power power)
        {
            if (power == null)
            {
                throw new ArgumentNullException("power");
            }

            StringBuilder result;
            List<string> additionalKeyWords;

            result = new StringBuilder();
            result.AppendFormat(string.Format("{0} ", power.Name));

            additionalKeyWords = new List<string>();
            additionalKeyWords.Add(CharacterRendererHelper.GetActionType(power.Action));
            if (power is AttackPower)
            {
                additionalKeyWords.Add("attack");
            }
            else if (power.PowerSource != PowerSource.Item && power is UtilityPower)
            {
                additionalKeyWords.Add("utility");
            }
            result.AppendFormat("({0})", string.Join("; ", additionalKeyWords.ToArray()));

            return result.ToString();
        }
开发者ID:anthonylangsworth,项目名称:GammaWorldCharacter,代码行数:39,代码来源:FlowDocumentPowerTracker.cs

示例6: MedicsWindow

        public MedicsWindow()
        {
            InitializeComponent();

            medico = new Medicos();

            medic = new Medic();
            service = new Service();
            speciality = new Speciality();


            medics = medic.GetAll();
            medicsGrid.ItemsSource = medics.ToArray();

            services = service.GetAll();
            foreach (ServicioMedico service in services)
            {
                comboService.Items.Add(service.nombre + " - " + service.descripcion);
            }

            specialities = speciality.GetAll();
            foreach (Especialidades speciality in specialities)
            {
                comboSpeciality.Items.Add(speciality.nombre + " - " + speciality.descripcion);
            }


        }
开发者ID:Maldercito,项目名称:adat,代码行数:28,代码来源:1453801388$MedicsWindow.xaml.cs

示例7: GetFriends

        /// <summary>
        /// 得到当前登录用户的好友列表,带scope参数
        /// </summary>
        /// <param name="sessionkey">当前用户的session_key</param>
        /// <param name="userid">当前用户的id</param>
        /// <param name="callback">回调函数</param>
        /// <param name="scope">额外需要返回的字段,多个字段用逗号(,)隔开。目前支持如下字段: headurl_with_logo, tinyurl_with_logo</param>
        /// <param name="count">返回每页个数,默认为500</param>
        /// <param name="page">分页,默认为1</param>
        public void GetFriends(DownloadStringCompletedHandler callback,List<string> scope, int count ,int page)
        {
            string accessToken = RenrenSDK.RenrenInfo.tokenInfo.access_token;
            string callID = String.Format("{0}", DateTime.Now.Second);

            List<APIParameter> parameters = new List<APIParameter>() {
                new APIParameter("method",Method.GetFriends)
            };
            parameters.Add(new APIParameter("access_token", accessToken));
            parameters.Add(new APIParameter("call_id", callID));
            parameters.Add(new APIParameter("v", "1.0"));
            parameters.Add(new APIParameter("userId", RenrenSDK.RenrenInfo.detailInfo.uid.ToString()));
            parameters.Add(new APIParameter("format", "JSON"));
            parameters.Add(new APIParameter("page", page.ToString()));
            if (count != 500) parameters.Add(new APIParameter("count", count.ToString()));
            if (scope != null && scope.Count > 0)
            {
                string[] arrScope = scope.ToArray<string>();
                parameters.Add(new APIParameter("fields", String.Join(" ", arrScope)));
            }
            string strSig = ApiHelper.CalSig(parameters);
            if (strSig == "")
                return;
            parameters.Add(new APIParameter("sig", strSig));

            RenrenWebRequest getFriendsAgent = new RenrenWebRequest();
            getFriendsAgent.DownloadStringCompleted +=
                new RenrenWebRequest.DownloadStringCompletedHandler(callback);
            getFriendsAgent.DownloadStringAsync(ConstantValue.RequestUri.ToString(), parameters);
        }
开发者ID:thynson,项目名称:renren-api-wp7-sdk,代码行数:39,代码来源:GetFriendsRequest.cs

示例8: GetFiles

		static public string[] GetFiles(string path)
		{
			path = path.Replace("\\", "/");
			List<string> files = Discovery.Resources;
			List<string> result = new List<string>();
			foreach (string file in files)
			{
				int idx = file.IndexOf(";component/");
				string f = file.Substring(idx + 11);
				if (f.Length >= path.Length &&
					f.Substring(0, path.Length).ToLower() == path.ToLower())
				{
					result.Add(file);					
				}
			}
			files = Discovery.Content;
			foreach (string file in files)
			{
				int idx = file.IndexOf("/");
				string f = file.Substring(idx + 1);
				if (f.Length >= path.Length &&
					f.Substring(0, path.Length).ToLower() == path.ToLower())
				{
					result.Add(file);
				}
			}
			return result.ToArray();
		}
开发者ID:liwq-net,项目名称:SilverSprite,代码行数:28,代码来源:Directory.cs

示例9: Create

		public static FrameworkElement Create(IClassificationFormatMap classificationFormatMap, string text, List<TextClassificationTag> tagsList, TextElementFlags flags) {
			bool useFastTextBlock = (flags & (TextElementFlags.TrimmingMask | TextElementFlags.WrapMask | TextElementFlags.FilterOutNewLines)) == (TextElementFlags.NoTrimming | TextElementFlags.NoWrap | TextElementFlags.FilterOutNewLines);
			bool filterOutNewLines = (flags & TextElementFlags.FilterOutNewLines) != 0;
			if (tagsList.Count != 0) {
				if (useFastTextBlock) {
					return new FastTextBlock((flags & TextElementFlags.NewFormatter) != 0, new TextSrc {
						text = ToString(text, filterOutNewLines),
						classificationFormatMap = classificationFormatMap,
						tagsList = tagsList.ToArray(),
					});
				}

				var propsSpans = tagsList.Select(a => new TextRunPropertiesAndSpan(a.Span, classificationFormatMap.GetTextProperties(a.ClassificationType)));
				var textBlock = TextBlockFactory.Create(text, classificationFormatMap.DefaultTextProperties, propsSpans, TextBlockFactory.Flags.DisableSetTextBlockFontFamily | TextBlockFactory.Flags.DisableFontSize | (filterOutNewLines ? TextBlockFactory.Flags.FilterOutNewlines : 0));
				textBlock.TextTrimming = GetTextTrimming(flags);
				textBlock.TextWrapping = GetTextWrapping(flags);
				return textBlock;
			}

			FrameworkElement fwElem;
			if (useFastTextBlock) {
				fwElem = new FastTextBlock((flags & TextElementFlags.NewFormatter) != 0) {
					Text = ToString(text, filterOutNewLines)
				};
			}
			else {
				fwElem = new TextBlock {
					Text = ToString(text, filterOutNewLines),
					TextTrimming = GetTextTrimming(flags),
					TextWrapping = GetTextWrapping(flags),
				};
			}
			return InitializeDefault(classificationFormatMap, fwElem);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:34,代码来源:TextElementFactory.cs

示例10: buttonSave_Click

        void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            List<Participant> newParticipants = new List<Participant>();

            foreach (Participant p in Participant.List)
            {
                if (p.AgeDivision == AgeDivisionButtons.SelectedValue + GenderButtons.SelectedValue &&
                    p.Team == TeamButtons.SelectedValue)
                {
                    continue;
                }

                newParticipants.Add(p);
            }

            // todo: doesnt delete participant results, could be a problem
            foreach (Participant p in SelectedParticipants)
            {
                if (p.Id == null || p.FirstName == null || p.LastName == null ||
                    p.Id.Length == 0 || p.FirstName.Length == 0 || p.LastName.Length == 0)
                {
                    continue;
                }

                p.AgeDivision = AgeDivisionButtons.SelectedValue + GenderButtons.SelectedValue;
                p.Team = TeamButtons.SelectedValue;
                newParticipants.Add(p);
            }

            Participant.Write(newParticipants.ToArray());
            RefreshList();
        }
开发者ID:dhaigh,项目名称:Swimalicious,代码行数:32,代码来源:ManageParticipants.xaml.cs

示例11: EmailWorkday

        public static void EmailWorkday(IEnumerable<Workday> workdays, String emailAddr)
        {
            if (workdays.Count() == 0)
                return;
            if (workdays.Count() == 1)
            {
                EmailWorkday(workdays.First(), emailAddr);
                return;
            }
            EmailComposeTask email = new EmailComposeTask();
            IEnumerable<Workday> w = from wd in workdays orderby wd.StartTime select wd;
            email.Subject = "Timesheets for " +
                w.First().StartTime.ToString("D") + " to " +
                w.Last().StartTime.ToString("D");
            List<String> texts = new List<String>();
            foreach (Workday i in w)
            {
                texts.Add(EmailFormatWorkday(i));
            }
            email.Body = String.Join(Environment.NewLine + "---" +
                Environment.NewLine + Environment.NewLine, texts.ToArray());

            if (emailAddr != null)
                email.To = emailAddr;

            email.Show();
        }
开发者ID:GalenVoss,项目名称:timecard-wp7,代码行数:27,代码来源:EmailHelper.cs

示例12: CreateFileWithSPDate

        public static void CreateFileWithSPDate()
        {
            PropertyInfo[] pi = typeof(EquilendExcelDataObjectSingleCtpy).GetProperties();
            List<string> data = new List<string>();

            int i = 1;

            data.Add("CREATE TABLE #EQUILENDTable(");

            foreach (var pt in pi)
            {
                string n = pt.Name + " varchar(150),";
                data.Add(n.PadRight(50) + "--" + i.ToString());
                i++;
            }
            data.Add(")");

            i = 1;

            data.Add("");
            data.Add("INSERT INTO #EQUILENDTable(");

            foreach (var pt in pi)
            {
                string n = pt.Name + ",";
                data.Add(n.PadRight(50) + "--" + i.ToString());
                i++;
            }
            data.Add(")");
            data.Add("VALUES (" + Environment.NewLine + Environment.NewLine + ")");

            File.WriteAllLines(AppDomain.CurrentDomain.BaseDirectory + "/AddToSP.txt", data.ToArray());
        }
开发者ID:alandias01,项目名称:cceq,代码行数:33,代码来源:MainWindow.xaml.cs

示例13: ResizeAndZipToStream

        //for each image on the filesystem pipe through all the streams up to the server
        //Resize and produce all the images through the resizer and into memory streams
        //pass all the memory streams into the zipper
        //Pass the Zipper out put stream into teh request stream.
        public void ResizeAndZipToStream(Stream outputStream, params string[] filePaths)
        {
            var streams = new List<StreamHolder>();
            MemoryStream ms;
            foreach (var path in filePaths)
            {
                var fs = File.OpenRead(path);
                {
                    ms = new MemoryStream();
                    StreamUtils.Copy(fs, ms, buffer);

                    string fileName = Path.GetFileName(path);
                    string ext = Path.GetExtension(path);
                    string prefix = Path.GetFileNameWithoutExtension(path);

                    var streamHolder = new StreamHolder(ms, fileName);

                    var sizes = new int[] { 100, 300, 500 };
                    foreach (int size in sizes)
                    {

                        ms.Seek(0, SeekOrigin.Begin);
                        streams.Add(ImageResizer.ResizeStream(ms, prefix + "_" + size.ToString() + ext, size));
                    }

                }
            }
            Zipper.CreateZip(outputStream, streams.ToArray());
        }
开发者ID:soitgoes,项目名称:Silverlight-Multiple-Jpeg-Uploader,代码行数:33,代码来源:Controller.cs

示例14: EnumerateFiles

        public static EnumFile[] EnumerateFiles(string folder)
        {
            InteropSvc.InteropLib.WIN32_FIND_DATA data;
            uint handle = InteropSvc.InteropLib.Instance.FindFirstFile7(folder + "\\*", out data);
            var list = new List<EnumFile>();

            if (handle != 0xFFFFFFFFU)
            {
                bool result = false;
                do
                {
                    if (data.cFileName != "." && data.cFileName != "..")
                    {
                        EnumFile ef = new EnumFile();
                        ef.FileName = data.cFileName;
                        bool t = ((data.dwFileAttributes & 0x10) == 0x10) ? true : false;
                        ef.isFolder = t ? true : false;
                        list.Add(ef);
                    }
                    result = InteropSvc.InteropLib.Instance.FindNextFile7(handle, out data);
                } while (result != false);
                InteropSvc.InteropLib.Instance.FindClose7(handle);
            }
            return list.ToArray();
        }
开发者ID:ultrashot,项目名称:ringtonemanager,代码行数:25,代码来源:MediaAttach.cs

示例15: EditParameterViewModel

        public EditParameterViewModel(OperationParameter parameter,
            ITestItemController  testItemController)
        {
            this.parameter = parameter;
            this.testItemController = testItemController;

            ValidationModes = Enum.GetNames(typeof (OperationParameterValueMode))
                .ToArray();

            SaveParameterCommand = new DelegateCommand(ExecuteSaveParameterCommand);
            CancelParameterCommand = new DelegateCommand(ExecuteCancelParameterCommand);

            Value = parameter.Value.ToString();
            SelectedValidationMode = parameter.Mode.ToString();

            List<string> vars = new List<string>();

            foreach (Variable variable in parameter.OwningTestItem.Test.Variables)
            {
                vars.Add(variable.Name);
                if (variable.VariableType == VariableType.TableValue)
                {
                    foreach (DataColumn col in variable.DataTableValue.Columns)
                    {
                        vars.Add(variable.Name + "[" + col.ColumnName + "]");
                    }
                }
            }

            Variables = vars.ToArray();
        }
开发者ID:philt5252,项目名称:GoldenHorse,代码行数:31,代码来源:EditParameterViewModel.cs


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