Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Scripting / Compiler / BoundConstants.cs / 1305376 / BoundConstants.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.Diagnostics; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Dynamic.Utils; #if SILVERLIGHT using System.Core; #endif namespace System.Linq.Expressions.Compiler { ////// This type tracks "runtime" constants--live objects that appear in /// ConstantExpression nodes and must be bound to the delegate. /// internal sealed class BoundConstants { ////// Constants can emit themselves as different types /// For caching purposes, we need to treat each distinct Type as a /// seperate thing to cache. (If we have to cast it on the way out, it /// ends up using a JIT temp and defeats the purpose of caching the /// value in a local) /// private struct TypedConstant : IEquatable{ internal readonly object Value; internal readonly Type Type; internal TypedConstant(object value, Type type) { Value = value; Type = type; } public override int GetHashCode() { return RuntimeHelpers.GetHashCode(Value) ^ Type.GetHashCode(); } public bool Equals(TypedConstant other) { return object.ReferenceEquals(Value, other.Value) && Type.Equals(other.Type); } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2231:OverloadOperatorEqualsOnOverridingValueTypeEquals")] public override bool Equals(object obj) { return (obj is TypedConstant) && Equals((TypedConstant)obj); } } /// /// The list of constants in the order they appear in the constant array /// private readonly List
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HtmlFormParameterWriter.cs
- CursorInteropHelper.cs
- NameTable.cs
- Object.cs
- NoneExcludedImageIndexConverter.cs
- SqlSupersetValidator.cs
- ElementAction.cs
- GridSplitterAutomationPeer.cs
- XmlDigitalSignatureProcessor.cs
- ElementHost.cs
- VirtualPath.cs
- State.cs
- SourceSwitch.cs
- CompilationRelaxations.cs
- SecurityNegotiationException.cs
- IconEditor.cs
- panel.cs
- GPRECTF.cs
- DesignerWidgets.cs
- EUCJPEncoding.cs
- DocumentSchemaValidator.cs
- WebHeaderCollection.cs
- DirtyTextRange.cs
- SafeNativeMethods.cs
- Expressions.cs
- ControlEvent.cs
- RPIdentityRequirement.cs
- XmlAttributeCache.cs
- EntityConnectionStringBuilder.cs
- ControlPersister.cs
- Odbc32.cs
- Vector.cs
- HtmlInputFile.cs
- Utils.cs
- xdrvalidator.cs
- WebPartConnectVerb.cs
- LinkConverter.cs
- TextAnchor.cs
- CollectionChangeEventArgs.cs
- ServerProtocol.cs
- _OverlappedAsyncResult.cs
- RbTree.cs
- SoundPlayer.cs
- OleDbWrapper.cs
- recordstatefactory.cs
- TypeHelper.cs
- TableLayoutPanelBehavior.cs
- Memoizer.cs
- RelativeSource.cs
- TemplateBamlTreeBuilder.cs
- EntityDataSourceDataSelectionPanel.cs
- MethodExpr.cs
- TextFormatterHost.cs
- SharedPerformanceCounter.cs
- LabelExpression.cs
- BeginCreateSecurityTokenRequest.cs
- ButtonFieldBase.cs
- ReachPageContentCollectionSerializerAsync.cs
- HtmlDocument.cs
- XPathNodePointer.cs
- KeyPullup.cs
- TextServicesHost.cs
- ModelPerspective.cs
- ImageMapEventArgs.cs
- SemaphoreFullException.cs
- Normalization.cs
- XmlNamespaceMapping.cs
- ScalarOps.cs
- WebServiceData.cs
- ExpandableObjectConverter.cs
- SchemaImporterExtensionsSection.cs
- HeaderedItemsControl.cs
- GrammarBuilderBase.cs
- NonParentingControl.cs
- DataTable.cs
- HeaderedContentControl.cs
- BoundColumn.cs
- FontStretchConverter.cs
- ErrorTolerantObjectWriter.cs
- WinFormsUtils.cs
- XmlArrayAttribute.cs
- OptimalBreakSession.cs
- CmsUtils.cs
- ValueProviderWrapper.cs
- TrackBar.cs
- Pair.cs
- XmlReflectionImporter.cs
- ValidationEventArgs.cs
- SoapIgnoreAttribute.cs
- FileDialogPermission.cs
- BaseInfoTable.cs
- Directory.cs
- OleDbReferenceCollection.cs
- TextRunCache.cs
- X509PeerCertificateAuthenticationElement.cs
- AssemblyCollection.cs
- CornerRadiusConverter.cs
- SplineKeyFrames.cs
- ProcessInfo.cs
- BooleanConverter.cs