Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Scripting / Actions / CallInfo.cs / 1305376 / CallInfo.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.Collections.ObjectModel; using System.Dynamic.Utils; using System.Linq.Expressions; #if SILVERLIGHT using System.Core; #endif //SILVERLIGHT namespace System.Dynamic { ////// Describes arguments in the dynamic binding process. /// ////// ArgumentCount - all inclusive number of arguments. /// ArgumentNames - names for those arguments that are named. /// /// Argument names match to the argument values in left to right order /// and last name corresponds to the last argument. /// /// Example: /// Foo(arg1, arg2, arg3, name1 = arg4, name2 = arg5, name3 = arg6) /// /// will correspond to: /// ArgumentCount: 6 /// ArgumentNames: {"name1", "name2", "name3"} /// public sealed class CallInfo { private readonly int _argCount; private readonly ReadOnlyCollection_argNames; /// /// Creates a new PositionalArgumentInfo. /// /// The number of arguments. /// The argument names. ///The new CallInfo public CallInfo(int argCount, params string[] argNames) : this(argCount, (IEnumerable)argNames) { } /// /// Creates a new CallInfo that represents arguments in the dynamic binding process. /// /// The number of arguments. /// The argument names. ///The new CallInfo public CallInfo(int argCount, IEnumerableargNames) { ContractUtils.RequiresNotNull(argNames, "argNames"); var argNameCol = argNames.ToReadOnly(); if (argCount < argNameCol.Count) throw Error.ArgCntMustBeGreaterThanNameCnt(); ContractUtils.RequiresNotNullItems(argNameCol, "argNames"); _argCount = argCount; _argNames = argNameCol; } /// /// The number of arguments. /// public int ArgumentCount { get { return _argCount; } } ////// The argument names. /// public ReadOnlyCollectionArgumentNames { get { return _argNames; } } /// /// Serves as a hash function for the current CallInfo. /// ///A hash code for the current CallInfo. public override int GetHashCode() { return _argCount ^ _argNames.ListHashCode(); } ////// Determines whether the specified CallInfo instance is considered equal to the current. /// /// The instance of CallInfo to compare with the current instance. ///true if the specified instance is equal to the current one otherwise, false. public override bool Equals(object obj) { var other = obj as CallInfo; return _argCount == other._argCount && _argNames.ListEquals(other._argNames); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. /* **************************************************************************** * * 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.Collections.ObjectModel; using System.Dynamic.Utils; using System.Linq.Expressions; #if SILVERLIGHT using System.Core; #endif //SILVERLIGHT namespace System.Dynamic { ////// Describes arguments in the dynamic binding process. /// ////// ArgumentCount - all inclusive number of arguments. /// ArgumentNames - names for those arguments that are named. /// /// Argument names match to the argument values in left to right order /// and last name corresponds to the last argument. /// /// Example: /// Foo(arg1, arg2, arg3, name1 = arg4, name2 = arg5, name3 = arg6) /// /// will correspond to: /// ArgumentCount: 6 /// ArgumentNames: {"name1", "name2", "name3"} /// public sealed class CallInfo { private readonly int _argCount; private readonly ReadOnlyCollection_argNames; /// /// Creates a new PositionalArgumentInfo. /// /// The number of arguments. /// The argument names. ///The new CallInfo public CallInfo(int argCount, params string[] argNames) : this(argCount, (IEnumerable)argNames) { } /// /// Creates a new CallInfo that represents arguments in the dynamic binding process. /// /// The number of arguments. /// The argument names. ///The new CallInfo public CallInfo(int argCount, IEnumerableargNames) { ContractUtils.RequiresNotNull(argNames, "argNames"); var argNameCol = argNames.ToReadOnly(); if (argCount < argNameCol.Count) throw Error.ArgCntMustBeGreaterThanNameCnt(); ContractUtils.RequiresNotNullItems(argNameCol, "argNames"); _argCount = argCount; _argNames = argNameCol; } /// /// The number of arguments. /// public int ArgumentCount { get { return _argCount; } } ////// The argument names. /// public ReadOnlyCollectionArgumentNames { get { return _argNames; } } /// /// Serves as a hash function for the current CallInfo. /// ///A hash code for the current CallInfo. public override int GetHashCode() { return _argCount ^ _argNames.ListHashCode(); } ////// Determines whether the specified CallInfo instance is considered equal to the current. /// /// The instance of CallInfo to compare with the current instance. ///true if the specified instance is equal to the current one otherwise, false. public override bool Equals(object obj) { var other = obj as CallInfo; return _argCount == other._argCount && _argNames.ListEquals(other._argNames); } } } // 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
- Cursors.cs
- Vector3dCollection.cs
- ValidatedMobileControlConverter.cs
- SqlConnectionFactory.cs
- Opcode.cs
- CompoundFileStreamReference.cs
- Win32KeyboardDevice.cs
- Repeater.cs
- BufferBuilder.cs
- CursorInteropHelper.cs
- CodeNamespaceImport.cs
- ToolStripItemTextRenderEventArgs.cs
- MessageQueuePermissionEntry.cs
- AssemblyBuilder.cs
- SafeViewOfFileHandle.cs
- DBBindings.cs
- DeferredTextReference.cs
- CodeParameterDeclarationExpression.cs
- FixedTextView.cs
- CalendarDateRangeChangingEventArgs.cs
- CmsInterop.cs
- IisTraceListener.cs
- HttpApplicationFactory.cs
- ISAPIWorkerRequest.cs
- DataGridViewRowsAddedEventArgs.cs
- XmlILAnnotation.cs
- XmlAttributeOverrides.cs
- MobileControlPersister.cs
- ArcSegment.cs
- ListChangedEventArgs.cs
- RoutedEventArgs.cs
- DataContract.cs
- DLinqDataModelProvider.cs
- ReflectPropertyDescriptor.cs
- InternalConfigSettingsFactory.cs
- PropertyCollection.cs
- MaterialCollection.cs
- EdmToObjectNamespaceMap.cs
- EntityKey.cs
- SoapCommonClasses.cs
- DictionaryEntry.cs
- NoPersistProperty.cs
- ImageButton.cs
- DirectoryNotFoundException.cs
- DtrList.cs
- BrowserCapabilitiesFactoryBase.cs
- UshortList2.cs
- EncryptedPackageFilter.cs
- XmlArrayItemAttributes.cs
- InvalidCardException.cs
- AppDomainEvidenceFactory.cs
- AbsoluteQuery.cs
- IndentTextWriter.cs
- IdentifierCreationService.cs
- CollaborationHelperFunctions.cs
- XmlQueryCardinality.cs
- HyperLinkColumn.cs
- NameValueSectionHandler.cs
- DataControlFieldCollection.cs
- SQLBinaryStorage.cs
- StylusPointPropertyInfoDefaults.cs
- _UriTypeConverter.cs
- FixedPageAutomationPeer.cs
- CustomPeerResolverService.cs
- DrawingContextDrawingContextWalker.cs
- TlsSspiNegotiation.cs
- Size3DConverter.cs
- TransformCryptoHandle.cs
- BulletedListEventArgs.cs
- ToolStripSystemRenderer.cs
- ClusterSafeNativeMethods.cs
- Library.cs
- ToolStripControlHost.cs
- RawStylusInputCustomData.cs
- GroupBoxRenderer.cs
- InternalConfigSettingsFactory.cs
- Misc.cs
- XmlnsDictionary.cs
- DomainConstraint.cs
- MD5CryptoServiceProvider.cs
- SHA384CryptoServiceProvider.cs
- Int64Converter.cs
- MulticastOption.cs
- hebrewshape.cs
- MappingSource.cs
- KerberosSecurityTokenAuthenticator.cs
- TextPenaltyModule.cs
- EntityRecordInfo.cs
- DesignerProperties.cs
- DirectoryInfo.cs
- smtppermission.cs
- ControlCommandSet.cs
- PathFigureCollection.cs
- XmlILConstructAnalyzer.cs
- ListMarkerSourceInfo.cs
- ProcessThreadCollection.cs
- ErrorFormatterPage.cs
- WinCategoryAttribute.cs
- NamespaceEmitter.cs
- SharedPersonalizationStateInfo.cs