Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Scripting / Utils / Helpers.cs / 1305376 / Helpers.cs
/* **************************************************************************** * * Copyright (c) Microsoft Corporation. * * This source code is subject to terms and conditions of the Microsoft Public License. A * copy of the license can be found in the License.html file at the root of this distribution. If * you cannot locate the Microsoft Public License, please send an email to * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound * by the terms of the Microsoft Public License. * * You must not remove this notice, or any other, from this software. * * * ***************************************************************************/ using System.Collections.Generic; using System.Linq.Expressions; namespace System.Dynamic.Utils { // Miscellaneous helpers that don't belong anywhere else internal static class Helpers { internal static T CommonNode(T first, T second, Func parent) where T : class { var cmp = EqualityComparer .Default; if (cmp.Equals(first, second)) { return first; } var set = new Set (cmp); for (T t = first; t != null; t = parent(t)) { set.Add(t); } for (T t = second; t != null; t = parent(t)) { if (set.Contains(t)) { return t; } } return null; } internal static void IncrementCount (T key, Dictionary dict) { int count; dict.TryGetValue(key, out count); dict[key] = count + 1; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BaseTemplateParser.cs
- DBSqlParserColumnCollection.cs
- XmlTextEncoder.cs
- ContentFileHelper.cs
- FileRegion.cs
- HostingMessageProperty.cs
- Divide.cs
- CorruptStoreException.cs
- HMACSHA1.cs
- UIElementParagraph.cs
- ArrayConverter.cs
- DataSourceControl.cs
- CodeComment.cs
- TracingConnectionInitiator.cs
- ReflectEventDescriptor.cs
- XamlToRtfWriter.cs
- StringKeyFrameCollection.cs
- TransformPatternIdentifiers.cs
- MenuAdapter.cs
- TextEncodedRawTextWriter.cs
- ElementProxy.cs
- DisposableCollectionWrapper.cs
- DataGridSortCommandEventArgs.cs
- XmlSerializationWriter.cs
- UserMapPath.cs
- HelpInfo.cs
- DocumentViewerAutomationPeer.cs
- RootAction.cs
- KeyValueInternalCollection.cs
- Executor.cs
- Knowncolors.cs
- cache.cs
- ControlCachePolicy.cs
- SecurityManager.cs
- ConditionalAttribute.cs
- Set.cs
- DataBinding.cs
- WebPartHeaderCloseVerb.cs
- DataMemberFieldConverter.cs
- TimeSpanConverter.cs
- TransportReplyChannelAcceptor.cs
- WS2007FederationHttpBinding.cs
- DayRenderEvent.cs
- SystemGatewayIPAddressInformation.cs
- PartialCachingControl.cs
- WindowsTab.cs
- PersonalizationProvider.cs
- DragDeltaEventArgs.cs
- PaperSize.cs
- Size3D.cs
- VirtualizedItemPattern.cs
- UIElementAutomationPeer.cs
- DataGridTablesFactory.cs
- ExceptionHandlers.cs
- Completion.cs
- Crc32.cs
- MSAAEventDispatcher.cs
- ServiceBuildProvider.cs
- Tablet.cs
- Keywords.cs
- UserNamePasswordValidator.cs
- InternalPolicyElement.cs
- _HeaderInfoTable.cs
- ThumbAutomationPeer.cs
- TreeNodeBinding.cs
- TemplateContainer.cs
- MultiAsyncResult.cs
- TextSpanModifier.cs
- UserMapPath.cs
- VirtualDirectoryMappingCollection.cs
- SingleObjectCollection.cs
- XmlComment.cs
- ControlFilterExpression.cs
- WebPartTransformer.cs
- OracleParameter.cs
- CreateUserWizardStep.cs
- BatchStream.cs
- DtdParser.cs
- ToolStripItemClickedEventArgs.cs
- X509Certificate.cs
- XmlDataCollection.cs
- TableCellCollection.cs
- SimpleType.cs
- SafeNativeMethods.cs
- LinkTarget.cs
- ClonableStack.cs
- DispatcherExceptionEventArgs.cs
- StructuredTypeEmitter.cs
- PropertyEntry.cs
- SamlSerializer.cs
- DataObjectMethodAttribute.cs
- HtmlTextViewAdapter.cs
- ACE.cs
- TogglePatternIdentifiers.cs
- Point4DValueSerializer.cs
- _Connection.cs
- SchemaImporter.cs
- ImportContext.cs
- XmlDigitalSignatureProcessor.cs
- ListBindingConverter.cs