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
- CommandLibraryHelper.cs
- DataGridViewRowCollection.cs
- OdbcConnectionOpen.cs
- HttpCacheParams.cs
- XmlLangPropertyAttribute.cs
- ProfileBuildProvider.cs
- Image.cs
- BitmapData.cs
- XmlSiteMapProvider.cs
- FileDialog_Vista.cs
- RecordsAffectedEventArgs.cs
- ThreadStartException.cs
- ListChangedEventArgs.cs
- StreamAsIStream.cs
- StrokeCollectionConverter.cs
- AttributeEmitter.cs
- DragDropHelper.cs
- ListCollectionView.cs
- NamedPipeTransportManager.cs
- ListBindingConverter.cs
- State.cs
- basevalidator.cs
- Executor.cs
- QueryOutputWriter.cs
- TagNameToTypeMapper.cs
- OutKeywords.cs
- TypeNameConverter.cs
- ErrorTableItemStyle.cs
- MultiPageTextView.cs
- Aes.cs
- SynchronousReceiveBehavior.cs
- DbXmlEnabledProviderManifest.cs
- MailWriter.cs
- SmtpMail.cs
- WebEvents.cs
- ReadOnlyCollection.cs
- CultureMapper.cs
- Vector3DCollectionConverter.cs
- SqlCommandBuilder.cs
- XmlNode.cs
- ToggleProviderWrapper.cs
- FilterQueryOptionExpression.cs
- DataGridViewRowConverter.cs
- FileDialog_Vista.cs
- PathFigureCollection.cs
- QueueProcessor.cs
- IPPacketInformation.cs
- ChannelServices.cs
- SelectedDatesCollection.cs
- WsiProfilesElement.cs
- Overlapped.cs
- Rule.cs
- SymbolTable.cs
- NetworkStream.cs
- QilStrConcat.cs
- XmlSignatureProperties.cs
- DataGridRowAutomationPeer.cs
- EntityDesignPluralizationHandler.cs
- DataRow.cs
- DelayLoadType.cs
- DataBoundControlActionList.cs
- InternalEnumValidator.cs
- QuaternionAnimationUsingKeyFrames.cs
- CodeDomLocalizationProvider.cs
- OrderedDictionary.cs
- ElementAtQueryOperator.cs
- SequentialActivityDesigner.cs
- FileUtil.cs
- ZipIORawDataFileBlock.cs
- LeftCellWrapper.cs
- BuildManager.cs
- BuildManager.cs
- DbDataReader.cs
- DateTimeOffsetConverter.cs
- Converter.cs
- PackageRelationshipCollection.cs
- CharacterString.cs
- Button.cs
- NamespaceImport.cs
- NetStream.cs
- RectConverter.cs
- NullableFloatSumAggregationOperator.cs
- XmlQuerySequence.cs
- DataGridTemplateColumn.cs
- Model3D.cs
- AttributeCollection.cs
- PageParser.cs
- Panel.cs
- unsafenativemethodstextservices.cs
- TreeView.cs
- RtfToXamlReader.cs
- UserControl.cs
- DocumentCollection.cs
- DbException.cs
- RoutedCommand.cs
- MarkupCompilePass2.cs
- XmlNavigatorStack.cs
- NetNamedPipeSecurityElement.cs
- SchemaExporter.cs
- HorizontalAlignConverter.cs