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


C# List.Count方法代码示例

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


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

示例1: ConnectToRealCache


//.........这里部分代码省略.........
					(m_rootFlid == MoAffixAllomorphTags.kflidPhoneEnv) ? "PhoneEnv" : "Position";
				m_fdoCache.DomainDataByFlid.BeginUndoTask(
					String.Format(DetailControlsStrings.ksUndoSet, fieldname),
					String.Format(DetailControlsStrings.ksRedoSet, fieldname));
				IPhEnvironmentFactory environmentFactory = m_fdoCache.ServiceLocator.GetInstance<IPhEnvironmentFactory>();
				IFdoOwningSequence<IPhEnvironment> allAvailablePhoneEnvironmentsInProject =
					m_fdoCache.LanguageProject.PhonologicalDataOA.EnvironmentsOS;

				var envsBeingRequestedForThisEntry = EnvsBeingRequestedForThisEntry();

				// Environments just typed into slice that are not already used for
				// this entry or known about in the project.
				var newEnvsJustTyped =
					envsBeingRequestedForThisEntry.Where(localDummyHvoOfAnEnvInEntry =>
						!allAvailablePhoneEnvironmentsInProject
							.Select(projectEnv => RemoveSpaces(projectEnv.StringRepresentation.Text))
							.Contains(RemoveSpaces(GetStringOfEnvironment(localDummyHvoOfAnEnvInEntry))));
				// Add the unknown/new environments to project
				foreach (var localDummyHvoOfAnEnvironmentInEntry in
					newEnvsJustTyped)
				{
					ITsString envTssRep = GetTsStringOfEnvironment(
						localDummyHvoOfAnEnvironmentInEntry);
					IPhEnvironment newEnv = environmentFactory.Create();
					allAvailablePhoneEnvironmentsInProject.Add(newEnv);
					newEnv.StringRepresentation = envTssRep;
				}

				var countOfExistingEnvironmentsInDatabaseForEntry =
					m_fdoCache.DomainDataByFlid.get_VecSize(m_rootObj.Hvo, m_rootFlid);
				// Contains environments already in entry or recently selected in
				// dialog, but not ones just typed
				int[] existingListOfEnvironmentHvosInDatabaseForEntry;
				int chvoMax = m_fdoCache.DomainDataByFlid.get_VecSize(
					m_rootObj.Hvo, m_rootFlid);
				using (ArrayPtr arrayPtr = MarshalEx.ArrayToNative<int>(chvoMax))
				{
					m_fdoCache.DomainDataByFlid.VecProp(m_rootObj.Hvo, m_rootFlid, chvoMax, out chvoMax, arrayPtr);
					existingListOfEnvironmentHvosInDatabaseForEntry = MarshalEx.NativeToArray<int>(arrayPtr, chvoMax);
				}

				// Build up a list of real hvos used in database for the
				// environments in the entry
				var newListOfEnvironmentHvosForEntry = new List<int>();
				foreach (var localDummyHvoOfAnEnvironmentInEntry in
					envsBeingRequestedForThisEntry)
				{
					ITsString envTssRep = GetTsStringOfEnvironment(
						localDummyHvoOfAnEnvironmentInEntry);
					string envStringRep = envTssRep.Text;

					// Pick a sensible environment from the known environments in
					// the project, by string
					IPhEnvironment anEnvironmentInEntry = FindPhoneEnv(
						allAvailablePhoneEnvironmentsInProject, envStringRep,
						newListOfEnvironmentHvosForEntry.ToArray(),
						existingListOfEnvironmentHvosInDatabaseForEntry);

					// Maybe the ws has changed, so change the real env in database,
					// in case.
					anEnvironmentInEntry.StringRepresentation = envTssRep;

					ITsStrBldr bldr = envTssRep.GetBldr();
					ConstraintFailure failure;
					if (anEnvironmentInEntry.CheckConstraints(PhEnvironmentTags.kflidStringRepresentation, false, out failure, true))
						ClearSquigglyLine(localDummyHvoOfAnEnvironmentInEntry, ref envTssRep, ref bldr);
					else
						MakeSquigglyLine(localDummyHvoOfAnEnvironmentInEntry, failure.XmlDescription, ref envTssRep, ref bldr);

					newListOfEnvironmentHvosForEntry.Add(anEnvironmentInEntry.Hvo);

					// Refresh
					m_sda.SetString(localDummyHvoOfAnEnvironmentInEntry, kEnvStringRep, bldr.GetString());
					m_rootb.PropChanged(localDummyHvoOfAnEnvironmentInEntry, kEnvStringRep, 0,
						envTssRep.Length, envTssRep.Length);
				}

				// Only reset the main property, if it has changed.
				// Otherwise, the parser gets too excited about needing to reload.
				if ((countOfExistingEnvironmentsInDatabaseForEntry !=
					newListOfEnvironmentHvosForEntry.Count()) ||
					!equalArrays(existingListOfEnvironmentHvosInDatabaseForEntry,
						newListOfEnvironmentHvosForEntry.ToArray()))
				{
					m_fdoCache.DomainDataByFlid.Replace(m_rootObj.Hvo, m_rootFlid, 0,
						countOfExistingEnvironmentsInDatabaseForEntry,
						newListOfEnvironmentHvosForEntry.ToArray(),
						newListOfEnvironmentHvosForEntry.Count());
				}
				m_fdoCache.DomainDataByFlid.EndUndoTask();
			}
			finally
			{
				if (wc != null)
				{
					wc.Dispose();
					wc = null;
				}
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:PhoneEnvReferenceView.cs


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