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
- DateTimeValueSerializerContext.cs
- TrackingDataItem.cs
- ObjectSet.cs
- TextBoxRenderer.cs
- SoapExtensionStream.cs
- SuppressMergeCheckAttribute.cs
- WorkflowIdleBehavior.cs
- KeyConverter.cs
- ObjectNavigationPropertyMapping.cs
- StorageAssociationTypeMapping.cs
- Expression.cs
- ControlLocalizer.cs
- Visual.cs
- TextSpanModifier.cs
- TextRangeAdaptor.cs
- WindowInteractionStateTracker.cs
- IUnknownConstantAttribute.cs
- PrimitiveDataContract.cs
- SqlRetyper.cs
- AnimationClock.cs
- WarningException.cs
- ActivityCollectionMarkupSerializer.cs
- FormView.cs
- ObjectStateManagerMetadata.cs
- Label.cs
- SqlConnectionHelper.cs
- DockAndAnchorLayout.cs
- DefaultAsyncDataDispatcher.cs
- ErrorFormatterPage.cs
- ChangeProcessor.cs
- ApplicationFileParser.cs
- GroupItemAutomationPeer.cs
- ArglessEventHandlerProxy.cs
- ValueTypeFixupInfo.cs
- Rotation3D.cs
- ControlSerializer.cs
- AuthenticationSection.cs
- Vertex.cs
- HtmlWindowCollection.cs
- ComponentEditorForm.cs
- DispatcherHooks.cs
- ListItemParagraph.cs
- PointKeyFrameCollection.cs
- DynamicResourceExtensionConverter.cs
- Model3DGroup.cs
- DiagnosticsConfigurationHandler.cs
- ImpersonateTokenRef.cs
- XsltException.cs
- ProtocolsSection.cs
- HttpRawResponse.cs
- Axis.cs
- WorkflowDesigner.cs
- WebControlParameterProxy.cs
- _DomainName.cs
- InternalRelationshipCollection.cs
- _DisconnectOverlappedAsyncResult.cs
- HuffCodec.cs
- HwndKeyboardInputProvider.cs
- contentDescriptor.cs
- BinHexDecoder.cs
- TdsParserSafeHandles.cs
- XmlParserContext.cs
- CatchBlock.cs
- ListSortDescription.cs
- SafeUserTokenHandle.cs
- Typography.cs
- TableHeaderCell.cs
- Form.cs
- GetRecipientListRequest.cs
- ListViewCommandEventArgs.cs
- FixedBufferAttribute.cs
- SelectionRangeConverter.cs
- AsymmetricSignatureDeformatter.cs
- DataGridViewIntLinkedList.cs
- TextEditorParagraphs.cs
- TraceRecord.cs
- RedistVersionInfo.cs
- DataGridGeneralPage.cs
- RowSpanVector.cs
- NullableLongMinMaxAggregationOperator.cs
- PropertyGrid.cs
- XMLUtil.cs
- CreateUserErrorEventArgs.cs
- HttpHandlerAction.cs
- EventHandlerService.cs
- ZipIOCentralDirectoryBlock.cs
- HelpEvent.cs
- SequentialUshortCollection.cs
- TextSearch.cs
- PkcsMisc.cs
- DataServiceQueryException.cs
- NameNode.cs
- TextBox.cs
- AnnotationAuthorChangedEventArgs.cs
- CompositeFontInfo.cs
- ToolStripDropDownItem.cs
- ConstraintCollection.cs
- AsyncCompletedEventArgs.cs
- CalendarDataBindingHandler.cs
- SafeFindHandle.cs