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
- ReferencedAssembly.cs
- Brush.cs
- RegularExpressionValidator.cs
- ThemeableAttribute.cs
- ExpressionLink.cs
- TypeDescriptionProvider.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- XmlSchemaSimpleTypeUnion.cs
- NamedPipeActivation.cs
- M3DUtil.cs
- TabControlCancelEvent.cs
- CacheVirtualItemsEvent.cs
- EnumValidator.cs
- ToolStripSeparatorRenderEventArgs.cs
- DateTimeFormatInfo.cs
- ApplicationDirectory.cs
- KeyedCollection.cs
- Rfc2898DeriveBytes.cs
- CodeValidator.cs
- LocalValueEnumerator.cs
- RadioButtonList.cs
- FlowDocument.cs
- WsdlInspector.cs
- WorkflowServiceBehavior.cs
- AccessDataSource.cs
- SecurityIdentifierElementCollection.cs
- WebPartEditorCancelVerb.cs
- InstanceDescriptor.cs
- EntityKey.cs
- MSAAEventDispatcher.cs
- FileEnumerator.cs
- WinFormsSpinner.cs
- DelimitedListTraceListener.cs
- DBNull.cs
- HtmlInputFile.cs
- WebCodeGenerator.cs
- EdmValidator.cs
- SoapIgnoreAttribute.cs
- ContextDataSource.cs
- HtmlInputImage.cs
- SafeNativeMethods.cs
- StickyNoteContentControl.cs
- RelatedPropertyManager.cs
- WebPartTracker.cs
- ListenerConnectionModeReader.cs
- shaperfactoryquerycacheentry.cs
- MediaPlayerState.cs
- CapabilitiesUse.cs
- LinqDataSourceValidationException.cs
- BitmapData.cs
- FontFamily.cs
- SortedList.cs
- Events.cs
- PlanCompiler.cs
- UndoManager.cs
- NullableConverter.cs
- SharedHttpTransportManager.cs
- SystemIcmpV4Statistics.cs
- EventLogInternal.cs
- PartialCachingAttribute.cs
- DBAsyncResult.cs
- _BaseOverlappedAsyncResult.cs
- LineServicesRun.cs
- Compress.cs
- LinkedResourceCollection.cs
- BidOverLoads.cs
- XmlSignatureManifest.cs
- DataServiceBuildProvider.cs
- RegisteredScript.cs
- CultureInfo.cs
- EntityConnectionStringBuilderItem.cs
- TagPrefixAttribute.cs
- Decorator.cs
- Native.cs
- Memoizer.cs
- Win32KeyboardDevice.cs
- MailSettingsSection.cs
- XmlSchemaAnyAttribute.cs
- Timeline.cs
- FieldDescriptor.cs
- DesignTimeParseData.cs
- _LocalDataStoreMgr.cs
- OutputWindow.cs
- InvalidBodyAccessException.cs
- InstanceContextMode.cs
- KeyedHashAlgorithm.cs
- RemoteHelper.cs
- MonitoringDescriptionAttribute.cs
- NetNamedPipeBindingElement.cs
- AsymmetricKeyExchangeFormatter.cs
- ObjectContextServiceProvider.cs
- _SslStream.cs
- ClientSection.cs
- DPAPIProtectedConfigurationProvider.cs
- PrefixHandle.cs
- BrushConverter.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- ExtenderProviderService.cs
- PageHandlerFactory.cs
- MouseBinding.cs