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
- HashSetDebugView.cs
- Formatter.cs
- GenericAuthenticationEventArgs.cs
- BaseDataList.cs
- TextChange.cs
- Point3DValueSerializer.cs
- WebPartTransformerAttribute.cs
- TextAdaptor.cs
- ConnectorSelectionGlyph.cs
- WebBrowsableAttribute.cs
- SingleStorage.cs
- SqlBinder.cs
- SoapReflectionImporter.cs
- DecimalStorage.cs
- CounterCreationData.cs
- ImageMap.cs
- DictionaryBase.cs
- ExpressionVisitor.cs
- Msec.cs
- Model3D.cs
- PagePropertiesChangingEventArgs.cs
- BinaryFormatterWriter.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- RoleGroup.cs
- EventManager.cs
- SqlConnectionHelper.cs
- WindowsFormsHost.cs
- QuaternionAnimation.cs
- NetworkInformationPermission.cs
- XmlMemberMapping.cs
- TemplateComponentConnector.cs
- TemplatedControlDesigner.cs
- AutomationIdentifierGuids.cs
- XmlSchemaValidationException.cs
- rsa.cs
- ApplicationBuildProvider.cs
- HtmlControlPersistable.cs
- HwndStylusInputProvider.cs
- ByteAnimationBase.cs
- ShapeTypeface.cs
- NativeMethods.cs
- ResourceIDHelper.cs
- NextPreviousPagerField.cs
- NetPipeSectionData.cs
- DbProviderFactory.cs
- CodeAttributeArgument.cs
- EventLog.cs
- X509KeyIdentifierClauseType.cs
- WebPageTraceListener.cs
- PartialArray.cs
- UrlPath.cs
- _BaseOverlappedAsyncResult.cs
- sqlcontext.cs
- SoapExtensionReflector.cs
- OdbcPermission.cs
- QueryReaderSettings.cs
- HttpRequest.cs
- SqlRowUpdatedEvent.cs
- TypefaceCollection.cs
- AssemblyUtil.cs
- SettingsAttributeDictionary.cs
- FrameworkContentElement.cs
- UInt32.cs
- SymbolEqualComparer.cs
- DomainConstraint.cs
- BamlBinaryReader.cs
- DBConnectionString.cs
- HttpListenerException.cs
- TemplateFactory.cs
- XmlSchemaObject.cs
- MimeTextImporter.cs
- EventDescriptorCollection.cs
- Knowncolors.cs
- BaseDataList.cs
- ActivityExecutionWorkItem.cs
- RectangleHotSpot.cs
- TextRangeBase.cs
- SessionSwitchEventArgs.cs
- EmptyControlCollection.cs
- BinarySerializer.cs
- SafeCertificateContext.cs
- ObjectKeyFrameCollection.cs
- SoundPlayerAction.cs
- IItemProperties.cs
- DataConnectionHelper.cs
- ImageAnimator.cs
- SerializationTrace.cs
- XmlCustomFormatter.cs
- XmlSchemaSimpleContentRestriction.cs
- ProcessModelSection.cs
- DataError.cs
- IisTraceWebEventProvider.cs
- StorageEntityTypeMapping.cs
- BufferManager.cs
- ScrollEventArgs.cs
- DbProviderFactory.cs
- ProfileBuildProvider.cs
- CallContext.cs
- PackWebResponse.cs
- DesignerRegionCollection.cs