本文整理汇总了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;
}
}
}