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
- DesignTable.cs
- WinCategoryAttribute.cs
- RectangleF.cs
- DashStyles.cs
- DetailsViewModeEventArgs.cs
- ReflectionPermission.cs
- TraceXPathNavigator.cs
- AppDomainProtocolHandler.cs
- SQLByte.cs
- TabControlCancelEvent.cs
- GroupBoxRenderer.cs
- FontFamily.cs
- ContainerActivationHelper.cs
- BindingListCollectionView.cs
- _Events.cs
- Guid.cs
- OutputCacheProviderCollection.cs
- AutomationElementCollection.cs
- ArraySet.cs
- Receive.cs
- BasicHttpBindingCollectionElement.cs
- DataContract.cs
- MonthChangedEventArgs.cs
- DesignBindingPropertyDescriptor.cs
- TextBox.cs
- SymbolTable.cs
- XmlSerializationWriter.cs
- ShapeTypeface.cs
- LassoSelectionBehavior.cs
- BufferedOutputStream.cs
- SmiContext.cs
- RightsManagementPermission.cs
- ParentQuery.cs
- CryptoApi.cs
- SamlAdvice.cs
- ColumnBinding.cs
- RewritingProcessor.cs
- FaultContractInfo.cs
- thaishape.cs
- ImageAnimator.cs
- PhysicalAddress.cs
- safesecurityhelperavalon.cs
- AssemblyAttributes.cs
- DockPatternIdentifiers.cs
- Base64Decoder.cs
- MonthChangedEventArgs.cs
- RegisteredDisposeScript.cs
- ValidatorCollection.cs
- DeobfuscatingStream.cs
- KnownTypes.cs
- OrderingInfo.cs
- ControlAdapter.cs
- BigInt.cs
- MeasureData.cs
- StylusDevice.cs
- ItemCollection.cs
- XmlReaderSettings.cs
- DispatcherExceptionFilterEventArgs.cs
- ThemeDictionaryExtension.cs
- SingleKeyFrameCollection.cs
- basenumberconverter.cs
- ApplicationServiceManager.cs
- Label.cs
- StructuredCompositeActivityDesigner.cs
- OleDbException.cs
- ScaleTransform3D.cs
- CompilationRelaxations.cs
- SerializationObjectManager.cs
- GridViewColumnHeaderAutomationPeer.cs
- UserControlParser.cs
- XmlSchemaSimpleTypeRestriction.cs
- DiagnosticTrace.cs
- HyperLinkDataBindingHandler.cs
- SqlUtils.cs
- TemplateBindingExpressionConverter.cs
- TrackingMemoryStreamFactory.cs
- ToolStripPanelCell.cs
- ScrollChangedEventArgs.cs
- XmlIlGenerator.cs
- WriteTimeStream.cs
- TextInfo.cs
- XmlTextAttribute.cs
- IChannel.cs
- ByteStack.cs
- XmlFormatExtensionPrefixAttribute.cs
- PackageDigitalSignature.cs
- DoubleUtil.cs
- FlagsAttribute.cs
- ToggleProviderWrapper.cs
- StorageComplexTypeMapping.cs
- TypedColumnHandler.cs
- XmlReflectionMember.cs
- WebPartPersonalization.cs
- Splitter.cs
- ChooseAction.cs
- SystemResourceHost.cs
- oledbmetadatacollectionnames.cs
- DataGridLength.cs
- CrossContextChannel.cs
- DeobfuscatingStream.cs