當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。