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
- RootNamespaceAttribute.cs
- DataTemplate.cs
- ThaiBuddhistCalendar.cs
- Identifier.cs
- DataGridViewRowStateChangedEventArgs.cs
- HtmlContainerControl.cs
- ArraySortHelper.cs
- PropertyDescriptorComparer.cs
- SrgsElementFactory.cs
- Image.cs
- MetadataPropertyvalue.cs
- ValidationErrorEventArgs.cs
- GraphicsContainer.cs
- XhtmlBasicLabelAdapter.cs
- ActivationService.cs
- CompoundFileDeflateTransform.cs
- StreamGeometryContext.cs
- ErrorStyle.cs
- VisualCollection.cs
- ForeignKeyConstraint.cs
- SafeFileHandle.cs
- Root.cs
- Color.cs
- DetailsViewDeleteEventArgs.cs
- IImplicitResourceProvider.cs
- DrawingContext.cs
- Win32Native.cs
- IntSecurity.cs
- DesignerForm.cs
- ToolStripPanelCell.cs
- FixedMaxHeap.cs
- XmlUtf8RawTextWriter.cs
- ValuePattern.cs
- QilTypeChecker.cs
- Tokenizer.cs
- DataGridToolTip.cs
- ClockGroup.cs
- DefaultProfileManager.cs
- WebConfigManager.cs
- DbConnectionStringCommon.cs
- ReliableDuplexSessionChannel.cs
- OutputCacheModule.cs
- UiaCoreProviderApi.cs
- IDReferencePropertyAttribute.cs
- IChannel.cs
- HttpApplication.cs
- VectorValueSerializer.cs
- PipelineDeploymentState.cs
- DeploymentSectionCache.cs
- ModuleElement.cs
- TypeConstant.cs
- ResXResourceReader.cs
- OdbcConnectionStringbuilder.cs
- ImageButton.cs
- ResourceExpression.cs
- Decimal.cs
- SynchronizationContext.cs
- HwndTarget.cs
- VersionedStreamOwner.cs
- Parallel.cs
- DropTarget.cs
- RadioButtonRenderer.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- hresults.cs
- Inline.cs
- InputProviderSite.cs
- PerformanceCounterManager.cs
- ControlCollection.cs
- MatrixConverter.cs
- ImageSourceConverter.cs
- RSAProtectedConfigurationProvider.cs
- ProcessModuleCollection.cs
- PropertyEmitterBase.cs
- util.cs
- NetCodeGroup.cs
- ExecutionContext.cs
- TypeDescriptionProviderAttribute.cs
- QueryPageSettingsEventArgs.cs
- EdmMember.cs
- LocalizationCodeDomSerializer.cs
- BackStopAuthenticationModule.cs
- TextServicesProperty.cs
- rsa.cs
- HttpConfigurationContext.cs
- FeatureManager.cs
- CompiledRegexRunner.cs
- ViewSimplifier.cs
- Privilege.cs
- ImportedNamespaceContextItem.cs
- BamlBinaryWriter.cs
- EnumerableValidator.cs
- TableRowGroup.cs
- BuilderInfo.cs
- xmlformatgeneratorstatics.cs
- HierarchicalDataSourceControl.cs
- ProtectedConfiguration.cs
- ListSortDescription.cs
- HostUtils.cs
- FolderLevelBuildProviderCollection.cs
- OracleBoolean.cs