Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Compiler / TypeSystem / MethodInfo.cs / 1305376 / MethodInfo.cs
#pragma warning disable 1634, 1691 namespace System.Workflow.ComponentModel.Compiler { using System; using System.CodeDom; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.ComponentModel.Design; using System.Diagnostics; using System.Globalization; using System.Reflection; #region DesignTimeConstructorInfo ////// This class takes care of static and non-static constructors /// internal sealed class DesignTimeConstructorInfo: ConstructorInfo { #region Members and Constructors private CodeMemberMethod codeConstructor = null; // Data associated with a bound ctor private DesignTimeType declaringType = null; // Data associated with this ctor private ParameterInfo[] parameters = null; private Attribute[] attributes = null; internal DesignTimeConstructorInfo(DesignTimeType declaringType, CodeMemberMethod codeConstructor) { this.declaringType = declaringType; this.codeConstructor = codeConstructor; } #endregion #region ConstructorInfo overrides public override Object Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) { throw new NotImplementedException(TypeSystemSR.GetString("Error_RuntimeNotSupported")); } #endregion #region MethodBase Overrides public override ParameterInfo[] GetParameters() { if (this.parameters == null) { // Get the parameters CodeParameterDeclarationExpressionCollection parameters = codeConstructor.Parameters; ParameterInfo[] paramArray = new ParameterInfo[parameters.Count]; for (int index = 0; index < parameters.Count; index++) { paramArray[index] = new DesignTimeParameterInfo(parameters[index], index, this); } this.parameters = paramArray; } return this.parameters; // } public override MethodImplAttributes GetMethodImplementationFlags() { return MethodImplAttributes.IL; } public override RuntimeMethodHandle MethodHandle { get { // not interested in Runtime information #pragma warning suppress 56503 throw new NotImplementedException(TypeSystemSR.GetString("Error_RuntimeNotSupported")); } } public override MethodAttributes Attributes { get { return Helper.ConvertToMethodAttributes(this.codeConstructor.Attributes); } } public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotImplementedException(TypeSystemSR.GetString("Error_RuntimeNotSupported")); } #endregion #region MemberInfo Overrides public override string Name { get { return ".ctor"; } } public override Type DeclaringType { get { return this.declaringType; } } public override Type ReflectedType { get { return this.declaringType; } } public override object[] GetCustomAttributes(bool inherit) { return GetCustomAttributes(typeof(object), inherit); } public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException("attributeType"); if (this.attributes == null) this.attributes = Helper.LoadCustomAttributes(this.codeConstructor.CustomAttributes, this.DeclaringType as DesignTimeType); return Helper.GetCustomAttributes(attributeType, inherit, this.attributes, this); } public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException("attributeType"); if (this.attributes == null) this.attributes = Helper.LoadCustomAttributes(this.codeConstructor.CustomAttributes, this.DeclaringType as DesignTimeType); if (Helper.IsDefined(attributeType, inherit, attributes, this)) return true; return false; } #endregion } #endregion #region DesignTimeMethodInfo internal class DesignTimeMethodInfo: MethodInfo { #region Members and Constructors private CodeMemberMethod methodInfo; private ParameterInfo[] parameters; // Data assocaited with a bound object private DesignTimeType declaringType; private Attribute[] attributes = null; private ParameterInfo returnParam = null; private bool isSpecialName = false; internal DesignTimeMethodInfo(DesignTimeType declaringType, CodeMemberMethod methodInfo, bool isSpecialName) { this.declaringType = declaringType; this.methodInfo = methodInfo; this.isSpecialName = isSpecialName; } internal DesignTimeMethodInfo(DesignTimeType declaringType, CodeMemberMethod methodInfo) { this.declaringType = declaringType; this.methodInfo = methodInfo; } #endregion #region Method Info overrides public override Type ReturnType { get { return declaringType.ResolveType(DesignTimeType.GetTypeNameFromCodeTypeReference(this.methodInfo.ReturnType, declaringType)); } } public override ICustomAttributeProvider ReturnTypeCustomAttributes { get { return null; } } public override MethodInfo GetBaseDefinition() { throw new NotImplementedException(); } public override ParameterInfo ReturnParameter { get { if(this.returnParam == null) this.returnParam = new DesignTimeParameterInfo(this.methodInfo.ReturnType, this); return this.returnParam; } } #endregion #region MethodBase Overrides public override ParameterInfo[] GetParameters() { if (this.parameters == null) { // Get the parameters CodeParameterDeclarationExpressionCollection parameters = this.methodInfo.Parameters; ParameterInfo[] paramArray = new ParameterInfo[parameters.Count]; for (int index = 0; index < parameters.Count; index++) { paramArray[index] = new DesignTimeParameterInfo(parameters[index], index, this); } this.parameters = paramArray; } return this.parameters; // } public override MethodImplAttributes GetMethodImplementationFlags() { return MethodImplAttributes.IL; } public override RuntimeMethodHandle MethodHandle { get { // not interested in Runtime information #pragma warning suppress 56503 throw new NotImplementedException(TypeSystemSR.GetString("Error_RuntimeNotSupported")); } } public override MethodAttributes Attributes { get { return Helper.ConvertToMethodAttributes(this.methodInfo.Attributes) | (this.isSpecialName?MethodAttributes.SpecialName:0); } } public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotImplementedException(TypeSystemSR.GetString("Error_RuntimeNotSupported")); } #endregion #region MemberInfo Overrides public override string Name { get { return Helper.EnsureTypeName(this.methodInfo.Name); } } public override Type DeclaringType { get { return this.declaringType; } } public override Type ReflectedType { get { return this.declaringType; } } public override object[] GetCustomAttributes(bool inherit) { return GetCustomAttributes(typeof(object), inherit); } public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException("attributeType"); if (this.attributes == null) if (this.methodInfo == null) this.attributes = new Attribute[0]; else this.attributes = Helper.LoadCustomAttributes(this.methodInfo.CustomAttributes, this.DeclaringType as DesignTimeType); return Helper.GetCustomAttributes(attributeType, inherit, this.attributes, this); } public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException("attributeType"); if (this.attributes == null) this.attributes = Helper.LoadCustomAttributes(this.methodInfo.CustomAttributes, this.DeclaringType as DesignTimeType); if (Helper.IsDefined(attributeType, inherit, attributes, this)) return true; return false; } #endregion } #endregion } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. #pragma warning disable 1634, 1691 namespace System.Workflow.ComponentModel.Compiler { using System; using System.CodeDom; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.ComponentModel.Design; using System.Diagnostics; using System.Globalization; using System.Reflection; #region DesignTimeConstructorInfo ////// This class takes care of static and non-static constructors /// internal sealed class DesignTimeConstructorInfo: ConstructorInfo { #region Members and Constructors private CodeMemberMethod codeConstructor = null; // Data associated with a bound ctor private DesignTimeType declaringType = null; // Data associated with this ctor private ParameterInfo[] parameters = null; private Attribute[] attributes = null; internal DesignTimeConstructorInfo(DesignTimeType declaringType, CodeMemberMethod codeConstructor) { this.declaringType = declaringType; this.codeConstructor = codeConstructor; } #endregion #region ConstructorInfo overrides public override Object Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) { throw new NotImplementedException(TypeSystemSR.GetString("Error_RuntimeNotSupported")); } #endregion #region MethodBase Overrides public override ParameterInfo[] GetParameters() { if (this.parameters == null) { // Get the parameters CodeParameterDeclarationExpressionCollection parameters = codeConstructor.Parameters; ParameterInfo[] paramArray = new ParameterInfo[parameters.Count]; for (int index = 0; index < parameters.Count; index++) { paramArray[index] = new DesignTimeParameterInfo(parameters[index], index, this); } this.parameters = paramArray; } return this.parameters; // } public override MethodImplAttributes GetMethodImplementationFlags() { return MethodImplAttributes.IL; } public override RuntimeMethodHandle MethodHandle { get { // not interested in Runtime information #pragma warning suppress 56503 throw new NotImplementedException(TypeSystemSR.GetString("Error_RuntimeNotSupported")); } } public override MethodAttributes Attributes { get { return Helper.ConvertToMethodAttributes(this.codeConstructor.Attributes); } } public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotImplementedException(TypeSystemSR.GetString("Error_RuntimeNotSupported")); } #endregion #region MemberInfo Overrides public override string Name { get { return ".ctor"; } } public override Type DeclaringType { get { return this.declaringType; } } public override Type ReflectedType { get { return this.declaringType; } } public override object[] GetCustomAttributes(bool inherit) { return GetCustomAttributes(typeof(object), inherit); } public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException("attributeType"); if (this.attributes == null) this.attributes = Helper.LoadCustomAttributes(this.codeConstructor.CustomAttributes, this.DeclaringType as DesignTimeType); return Helper.GetCustomAttributes(attributeType, inherit, this.attributes, this); } public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException("attributeType"); if (this.attributes == null) this.attributes = Helper.LoadCustomAttributes(this.codeConstructor.CustomAttributes, this.DeclaringType as DesignTimeType); if (Helper.IsDefined(attributeType, inherit, attributes, this)) return true; return false; } #endregion } #endregion #region DesignTimeMethodInfo internal class DesignTimeMethodInfo: MethodInfo { #region Members and Constructors private CodeMemberMethod methodInfo; private ParameterInfo[] parameters; // Data assocaited with a bound object private DesignTimeType declaringType; private Attribute[] attributes = null; private ParameterInfo returnParam = null; private bool isSpecialName = false; internal DesignTimeMethodInfo(DesignTimeType declaringType, CodeMemberMethod methodInfo, bool isSpecialName) { this.declaringType = declaringType; this.methodInfo = methodInfo; this.isSpecialName = isSpecialName; } internal DesignTimeMethodInfo(DesignTimeType declaringType, CodeMemberMethod methodInfo) { this.declaringType = declaringType; this.methodInfo = methodInfo; } #endregion #region Method Info overrides public override Type ReturnType { get { return declaringType.ResolveType(DesignTimeType.GetTypeNameFromCodeTypeReference(this.methodInfo.ReturnType, declaringType)); } } public override ICustomAttributeProvider ReturnTypeCustomAttributes { get { return null; } } public override MethodInfo GetBaseDefinition() { throw new NotImplementedException(); } public override ParameterInfo ReturnParameter { get { if(this.returnParam == null) this.returnParam = new DesignTimeParameterInfo(this.methodInfo.ReturnType, this); return this.returnParam; } } #endregion #region MethodBase Overrides public override ParameterInfo[] GetParameters() { if (this.parameters == null) { // Get the parameters CodeParameterDeclarationExpressionCollection parameters = this.methodInfo.Parameters; ParameterInfo[] paramArray = new ParameterInfo[parameters.Count]; for (int index = 0; index < parameters.Count; index++) { paramArray[index] = new DesignTimeParameterInfo(parameters[index], index, this); } this.parameters = paramArray; } return this.parameters; // } public override MethodImplAttributes GetMethodImplementationFlags() { return MethodImplAttributes.IL; } public override RuntimeMethodHandle MethodHandle { get { // not interested in Runtime information #pragma warning suppress 56503 throw new NotImplementedException(TypeSystemSR.GetString("Error_RuntimeNotSupported")); } } public override MethodAttributes Attributes { get { return Helper.ConvertToMethodAttributes(this.methodInfo.Attributes) | (this.isSpecialName?MethodAttributes.SpecialName:0); } } public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotImplementedException(TypeSystemSR.GetString("Error_RuntimeNotSupported")); } #endregion #region MemberInfo Overrides public override string Name { get { return Helper.EnsureTypeName(this.methodInfo.Name); } } public override Type DeclaringType { get { return this.declaringType; } } public override Type ReflectedType { get { return this.declaringType; } } public override object[] GetCustomAttributes(bool inherit) { return GetCustomAttributes(typeof(object), inherit); } public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException("attributeType"); if (this.attributes == null) if (this.methodInfo == null) this.attributes = new Attribute[0]; else this.attributes = Helper.LoadCustomAttributes(this.methodInfo.CustomAttributes, this.DeclaringType as DesignTimeType); return Helper.GetCustomAttributes(attributeType, inherit, this.attributes, this); } public override bool IsDefined(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException("attributeType"); if (this.attributes == null) this.attributes = Helper.LoadCustomAttributes(this.methodInfo.CustomAttributes, this.DeclaringType as DesignTimeType); if (Helper.IsDefined(attributeType, inherit, attributes, this)) return true; return false; } #endregion } #endregion } // 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
- GridProviderWrapper.cs
- MatrixAnimationUsingKeyFrames.cs
- ColorIndependentAnimationStorage.cs
- RelationshipManager.cs
- DescriptionAttribute.cs
- SchemaImporterExtension.cs
- Wrapper.cs
- TimeSpanValidatorAttribute.cs
- SamlAuthorityBinding.cs
- IsolatedStorageFilePermission.cs
- RawStylusActions.cs
- MD5Cng.cs
- AnnouncementEventArgs.cs
- DataGridViewCellPaintingEventArgs.cs
- HyperLinkDataBindingHandler.cs
- MouseActionConverter.cs
- InvalidFilterCriteriaException.cs
- WebControl.cs
- ExceptionHandlerDesigner.cs
- AtomContentProperty.cs
- SettingsPropertyIsReadOnlyException.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- HealthMonitoringSection.cs
- PropertyItem.cs
- XmlSerializationReader.cs
- SubordinateTransaction.cs
- QueryComponents.cs
- X509Certificate2.cs
- InternalMappingException.cs
- PeerCollaborationPermission.cs
- Utils.cs
- TaiwanLunisolarCalendar.cs
- TabPage.cs
- Rect.cs
- FilteredReadOnlyMetadataCollection.cs
- TextProperties.cs
- Effect.cs
- ProfileManager.cs
- XmlSerializationWriter.cs
- DefaultBinder.cs
- CodeDesigner.cs
- RightNameExpirationInfoPair.cs
- RightNameExpirationInfoPair.cs
- X509Utils.cs
- FontStretch.cs
- EventManager.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- FigureParaClient.cs
- StylusCaptureWithinProperty.cs
- IndividualDeviceConfig.cs
- NonSerializedAttribute.cs
- WebProxyScriptElement.cs
- DataSourceComponent.cs
- XmlQueryRuntime.cs
- MatrixAnimationUsingPath.cs
- DeclaredTypeValidator.cs
- NonBatchDirectoryCompiler.cs
- TraceUtils.cs
- HtmlImageAdapter.cs
- ContainerFilterService.cs
- GPRECT.cs
- Inflater.cs
- ToolStripItemTextRenderEventArgs.cs
- InternalConfigSettingsFactory.cs
- OneToOneMappingSerializer.cs
- NullableLongSumAggregationOperator.cs
- PassportAuthentication.cs
- QilLiteral.cs
- GZipStream.cs
- DecoratedNameAttribute.cs
- SortQuery.cs
- CompilerInfo.cs
- ProfilePropertyMetadata.cs
- ImageDrawing.cs
- ProxyWebPartConnectionCollection.cs
- UseAttributeSetsAction.cs
- OracleMonthSpan.cs
- GroupLabel.cs
- MimeTextImporter.cs
- InvalidPrinterException.cs
- HostedTransportConfigurationManager.cs
- UserControlCodeDomTreeGenerator.cs
- ConditionalAttribute.cs
- LocalizationParserHooks.cs
- PropertyChangedEventArgs.cs
- VersionedStream.cs
- XmlAutoDetectWriter.cs
- CodeLabeledStatement.cs
- Internal.cs
- EntityDataSourceContextDisposingEventArgs.cs
- Dictionary.cs
- PropertyTabAttribute.cs
- DocumentCollection.cs
- DbConnectionPoolOptions.cs
- PolyLineSegmentFigureLogic.cs
- TypeExtensions.cs
- DateTime.cs
- DataColumnCollection.cs
- ActivationServices.cs
- CaseInsensitiveHashCodeProvider.cs