Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntityDesign / Design / System / Data / Entity / Design / PluralizationService / PluralizationServiceUtil.cs / 1305376 / PluralizationServiceUtil.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.Globalization; namespace System.Data.Entity.Design.PluralizationServices { internal static class PluralizationServiceUtil { internal static bool DoesWordContainSuffix(string word, IEnumerablesuffixes, CultureInfo culture) { if (suffixes.Any(s => word.EndsWith(s, true, culture))) { return true; } else { return false; } } internal static bool TryGetMatchedSuffixForWord(string word, IEnumerable suffixes, CultureInfo culture, out string matchedSuffix) { matchedSuffix = null; if (DoesWordContainSuffix(word, suffixes, culture)) { matchedSuffix = suffixes.First(s => word.EndsWith(s, true, culture)); return true; } else { return false; } } internal static bool TryInflectOnSuffixInWord(string word, IEnumerable suffixes, Func operationOnWord, CultureInfo culture, out string newWord) { newWord = null; string matchedSuffixString; if (PluralizationServiceUtil.TryGetMatchedSuffixForWord( word, suffixes, culture, out matchedSuffixString)) { newWord = operationOnWord(word); return true; } else { return false; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.Globalization; namespace System.Data.Entity.Design.PluralizationServices { internal static class PluralizationServiceUtil { internal static bool DoesWordContainSuffix(string word, IEnumerablesuffixes, CultureInfo culture) { if (suffixes.Any(s => word.EndsWith(s, true, culture))) { return true; } else { return false; } } internal static bool TryGetMatchedSuffixForWord(string word, IEnumerable suffixes, CultureInfo culture, out string matchedSuffix) { matchedSuffix = null; if (DoesWordContainSuffix(word, suffixes, culture)) { matchedSuffix = suffixes.First(s => word.EndsWith(s, true, culture)); return true; } else { return false; } } internal static bool TryInflectOnSuffixInWord(string word, IEnumerable suffixes, Func operationOnWord, CultureInfo culture, out string newWord) { newWord = null; string matchedSuffixString; if (PluralizationServiceUtil.TryGetMatchedSuffixForWord( word, suffixes, culture, out matchedSuffixString)) { newWord = operationOnWord(word); return true; } else { return false; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FactoryGenerator.cs
- TypeConverterAttribute.cs
- HttpPostedFile.cs
- PersonalizationStateInfoCollection.cs
- EventProperty.cs
- InvokeMethodActivity.cs
- SoapIncludeAttribute.cs
- FormViewPageEventArgs.cs
- TextEditorTyping.cs
- RootBrowserWindow.cs
- XmlWriter.cs
- ColorContextHelper.cs
- NumberSubstitution.cs
- TextServicesDisplayAttribute.cs
- DateTimeOffset.cs
- DocumentGridContextMenu.cs
- XmlSubtreeReader.cs
- EventLevel.cs
- ContainerSelectorGlyph.cs
- Page.cs
- MatrixUtil.cs
- ProgressPage.cs
- InvalidComObjectException.cs
- ClientReliableChannelBinder.cs
- ExpandCollapseProviderWrapper.cs
- MetaType.cs
- PerformanceCounterLib.cs
- ContainerParaClient.cs
- Update.cs
- TreeNodeCollection.cs
- TextDecorationCollection.cs
- ComAwareEventInfo.cs
- SecurityDescriptor.cs
- ProxyWebPartConnectionCollection.cs
- Simplifier.cs
- ExpressionBuilder.cs
- EdmItemError.cs
- ExpressionConverter.cs
- PathSegmentCollection.cs
- AutomationIdentifier.cs
- Process.cs
- DataMisalignedException.cs
- MenuItemBindingCollection.cs
- SizeConverter.cs
- TcpSocketManager.cs
- IdentitySection.cs
- ToolStripMenuItemCodeDomSerializer.cs
- SynchronizingStream.cs
- RestHandlerFactory.cs
- Win32.cs
- CodeAttachEventStatement.cs
- Expander.cs
- SynchronizationLockException.cs
- SafeNativeMethodsMilCoreApi.cs
- ToolStripDropDownButton.cs
- TdsParserSafeHandles.cs
- CommunicationObjectManager.cs
- XmlAttributeCollection.cs
- GlyphingCache.cs
- OutputWindow.cs
- AutomationEventArgs.cs
- GenericsInstances.cs
- Context.cs
- KoreanLunisolarCalendar.cs
- ContentTypeSettingDispatchMessageFormatter.cs
- AttachmentService.cs
- CodeMethodMap.cs
- RegexEditorDialog.cs
- MenuAdapter.cs
- ButtonChrome.cs
- ColumnHeaderCollectionEditor.cs
- DbProviderConfigurationHandler.cs
- DataGridViewLinkCell.cs
- SingleResultAttribute.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- FactoryMaker.cs
- ImageAutomationPeer.cs
- cryptoapiTransform.cs
- ToolboxComponentsCreatingEventArgs.cs
- JavaScriptString.cs
- QuaternionRotation3D.cs
- EntityCodeGenerator.cs
- EntityCommandCompilationException.cs
- MsmqQueue.cs
- CollectionContainer.cs
- TimeStampChecker.cs
- DataSetUtil.cs
- CategoryEditor.cs
- NavigatorInvalidBodyAccessException.cs
- NavigationWindowAutomationPeer.cs
- VirtualPathProvider.cs
- ReflectionUtil.cs
- CustomPopupPlacement.cs
- JapaneseLunisolarCalendar.cs
- arclist.cs
- ForceCopyBuildProvider.cs
- TextContainer.cs
- AsymmetricAlgorithm.cs
- WmfPlaceableFileHeader.cs
- EditorServiceContext.cs