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
- CountAggregationOperator.cs
- FormViewPageEventArgs.cs
- WindowsTokenRoleProvider.cs
- UnconditionalPolicy.cs
- CompositeCollectionView.cs
- DeadCharTextComposition.cs
- DataRecordObjectView.cs
- _FtpControlStream.cs
- HtmlElementCollection.cs
- DelimitedListTraceListener.cs
- StackSpiller.Temps.cs
- CatalogZone.cs
- ImageEditor.cs
- ContainerActivationHelper.cs
- DirectoryObjectSecurity.cs
- ContentElement.cs
- XhtmlBasicLinkAdapter.cs
- Operators.cs
- X509Logo.cs
- SelectionEditor.cs
- SendParametersContent.cs
- RepeatBehavior.cs
- DataPager.cs
- SqlBulkCopy.cs
- DataGridViewBindingCompleteEventArgs.cs
- XhtmlCssHandler.cs
- AmbiguousMatchException.cs
- ObjectStateFormatter.cs
- SyndicationFeed.cs
- PanelStyle.cs
- NetworkInterface.cs
- SymbolType.cs
- FontCacheUtil.cs
- DynamicResourceExtensionConverter.cs
- ColumnMap.cs
- MenuItemBinding.cs
- PointValueSerializer.cs
- AsyncWaitHandle.cs
- HMACSHA384.cs
- CapabilitiesRule.cs
- MessagingActivityHelper.cs
- EdmItemCollection.cs
- BlurEffect.cs
- RestHandler.cs
- ExtendedProperty.cs
- SafeArrayTypeMismatchException.cs
- LinqDataSourceInsertEventArgs.cs
- Adorner.cs
- OrderedHashRepartitionStream.cs
- CheckBox.cs
- IisTraceListener.cs
- WebBrowsableAttribute.cs
- CompilerResults.cs
- PostBackTrigger.cs
- DataGridViewIntLinkedList.cs
- RelativeSource.cs
- ProfileProvider.cs
- DataGridViewCheckBoxCell.cs
- ResourceIDHelper.cs
- ConfigurationPropertyAttribute.cs
- SR.cs
- ObjectFullSpanRewriter.cs
- SmtpNegotiateAuthenticationModule.cs
- PropertyEmitterBase.cs
- IdleTimeoutMonitor.cs
- SrgsElementList.cs
- MSHTMLHost.cs
- Grid.cs
- PropertyTabChangedEvent.cs
- MenuAutomationPeer.cs
- FileAccessException.cs
- Color.cs
- TextFindEngine.cs
- PenLineJoinValidation.cs
- CheckBoxField.cs
- Int32Converter.cs
- ReadOnlyDictionary.cs
- BindingExpressionUncommonField.cs
- IDReferencePropertyAttribute.cs
- AppPool.cs
- SecurityUtils.cs
- Comparer.cs
- ButtonChrome.cs
- Utils.cs
- UIPropertyMetadata.cs
- ConnectionConsumerAttribute.cs
- EncryptedPackageFilter.cs
- RightNameExpirationInfoPair.cs
- ICspAsymmetricAlgorithm.cs
- ServicePointManagerElement.cs
- ReadOnlyHierarchicalDataSourceView.cs
- TagPrefixAttribute.cs
- ResXFileRef.cs
- FunctionMappingTranslator.cs
- StorageEndPropertyMapping.cs
- KeyValuePair.cs
- DataTableTypeConverter.cs
- TrustManager.cs
- IndicShape.cs
- RequestTimeoutManager.cs