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
- OleDbConnection.cs
- XmlReaderDelegator.cs
- HttpDictionary.cs
- Label.cs
- ApplicationId.cs
- URLMembershipCondition.cs
- Win32PrintDialog.cs
- ScalarType.cs
- HtmlInputControl.cs
- GlyphInfoList.cs
- ObjectResult.cs
- Helpers.cs
- SqlMethods.cs
- TraceUtility.cs
- FontSizeConverter.cs
- Message.cs
- ListViewInsertionMark.cs
- WebDisplayNameAttribute.cs
- ContentPlaceHolder.cs
- Types.cs
- AnimationTimeline.cs
- VSWCFServiceContractGenerator.cs
- BaseTypeViewSchema.cs
- DataGridViewCellParsingEventArgs.cs
- AttachedPropertyMethodSelector.cs
- WorkflowEventArgs.cs
- GridViewRowPresenter.cs
- PseudoWebRequest.cs
- AppModelKnownContentFactory.cs
- SchemaType.cs
- AssemblyAttributes.cs
- Opcode.cs
- ToolStripDropDownClosingEventArgs.cs
- PageSetupDialog.cs
- XmlAutoDetectWriter.cs
- ReferencedType.cs
- AspCompat.cs
- HandleExceptionArgs.cs
- SqlDataSourceConfigureFilterForm.cs
- SqlSelectStatement.cs
- BitmapEffect.cs
- ColumnResult.cs
- ActivityCodeDomSerializationManager.cs
- SecurityAlgorithmSuite.cs
- XmlSiteMapProvider.cs
- Stack.cs
- XamlInt32CollectionSerializer.cs
- HtmlAnchor.cs
- CaseInsensitiveComparer.cs
- CompareValidator.cs
- SizeConverter.cs
- WebColorConverter.cs
- SystemInformation.cs
- DateTimeParse.cs
- MemberCollection.cs
- CompilerTypeWithParams.cs
- DataGridViewCellValidatingEventArgs.cs
- UnionCqlBlock.cs
- KeyboardEventArgs.cs
- DocumentCollection.cs
- TaiwanLunisolarCalendar.cs
- StrongNamePublicKeyBlob.cs
- ProcessInfo.cs
- MemberJoinTreeNode.cs
- CreateUserWizard.cs
- PersonalizationStateInfoCollection.cs
- Inflater.cs
- Parser.cs
- TraceShell.cs
- CodeGeneratorAttribute.cs
- ViewLoader.cs
- TimeoutTimer.cs
- Base64Stream.cs
- HttpClientCertificate.cs
- SystemPens.cs
- PlatformCulture.cs
- IDReferencePropertyAttribute.cs
- ListViewUpdateEventArgs.cs
- TextServicesLoader.cs
- LicenseManager.cs
- itemelement.cs
- XmlValueConverter.cs
- DataGridViewColumnCollectionDialog.cs
- XPathPatternBuilder.cs
- CodeDelegateCreateExpression.cs
- JsonReaderWriterFactory.cs
- AuthStoreRoleProvider.cs
- ViewRendering.cs
- ConsumerConnectionPoint.cs
- StrokeCollection2.cs
- PropertyManager.cs
- C14NUtil.cs
- DesignerResources.cs
- cookie.cs
- SmiTypedGetterSetter.cs
- DisposableCollectionWrapper.cs
- EncoderFallback.cs
- PointAnimationUsingKeyFrames.cs
- SoapFault.cs
- WCFModelStrings.Designer.cs