Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / clr / src / BCL / System / Reflection / Emit / GenericTypeParameterBuilder.cs / 1 / GenericTypeParameterBuilder.cs
using System; using System.Reflection; using System.Reflection.Emit; using System.Collections; using System.Globalization; namespace System.Reflection.Emit { [System.Runtime.InteropServices.ComVisible(true)] public sealed class GenericTypeParameterBuilder: Type { #region Private Data Mebers internal TypeBuilder m_type; #endregion #region Constructor internal GenericTypeParameterBuilder(TypeBuilder type) { m_type = type; } #endregion #region Object Overrides public override String ToString() { return m_type.Name; } public override bool Equals(object o) { GenericTypeParameterBuilder g = o as GenericTypeParameterBuilder; if (g == null) return false; return g.m_type == m_type; } public override int GetHashCode() { return m_type.GetHashCode(); } #endregion #region MemberInfo Overrides public override Type DeclaringType { get { return m_type.DeclaringType; } } public override Type ReflectedType { get { return m_type.ReflectedType; } } public override String Name { get { return m_type.Name; } } public override Module Module { get { return m_type.Module; } } internal override int MetadataTokenInternal { get { return m_type.MetadataTokenInternal; } } #endregion #region Type Overrides public override Type MakePointerType() { return SymbolType.FormCompoundType("*".ToCharArray(), this, 0); } public override Type MakeByRefType() { return SymbolType.FormCompoundType("&".ToCharArray(), this, 0); } public override Type MakeArrayType() { return SymbolType.FormCompoundType("[]".ToCharArray(), this, 0); } public override Type MakeArrayType(int rank) { if (rank <= 0) throw new IndexOutOfRangeException(); string szrank = ""; if (rank == 1) { szrank = "*"; } else { for(int i = 1; i < rank; i++) szrank += ","; } string s = String.Format(CultureInfo.InvariantCulture, "[{0}]", szrank); // [,,] SymbolType st = SymbolType.FormCompoundType(s.ToCharArray(), this, 0) as SymbolType; return st; } public override Guid GUID { get { throw new NotSupportedException(); } } public override Object InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) { throw new NotSupportedException(); } public override Assembly Assembly { get { return m_type.Assembly; } } public override RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } } public override String FullName { get { return null; } } public override String Namespace { get { return null; } } public override String AssemblyQualifiedName { get { return null; } } public override Type BaseType { get { return m_type.BaseType; } } protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw new NotSupportedException(); } [System.Runtime.InteropServices.ComVisible(true)] public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr) { throw new NotSupportedException(); } protected override MethodInfo GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw new NotSupportedException(); } public override MethodInfo[] GetMethods(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override FieldInfo GetField(String name, BindingFlags bindingAttr) { throw new NotSupportedException(); } public override FieldInfo[] GetFields(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override Type GetInterface(String name, bool ignoreCase) { throw new NotSupportedException(); } public override Type[] GetInterfaces() { throw new NotSupportedException(); } public override EventInfo GetEvent(String name, BindingFlags bindingAttr) { throw new NotSupportedException(); } public override EventInfo[] GetEvents() { throw new NotSupportedException(); } protected override PropertyInfo GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) { throw new NotSupportedException(); } public override PropertyInfo[] GetProperties(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override Type[] GetNestedTypes(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override Type GetNestedType(String name, BindingFlags bindingAttr) { throw new NotSupportedException(); } public override MemberInfo[] GetMember(String name, MemberTypes type, BindingFlags bindingAttr) { throw new NotSupportedException(); } [System.Runtime.InteropServices.ComVisible(true)] public override InterfaceMapping GetInterfaceMap(Type interfaceType) { throw new NotSupportedException(); } public override EventInfo[] GetEvents(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override MemberInfo[] GetMembers(BindingFlags bindingAttr) { throw new NotSupportedException(); } protected override TypeAttributes GetAttributeFlagsImpl() { throw new NotSupportedException(); } protected override bool IsArrayImpl() { return false; } protected override bool IsByRefImpl() { return false; } protected override bool IsPointerImpl() { return false; } protected override bool IsPrimitiveImpl() { return false; } protected override bool IsCOMObjectImpl() { return false; } public override Type GetElementType() { throw new NotSupportedException(); } protected override bool HasElementTypeImpl() { return false; } public override Type UnderlyingSystemType { get { return this; } } public override Type[] GetGenericArguments() { throw new InvalidOperationException(); } public override bool IsGenericTypeDefinition { get { return false; } } public override bool IsGenericType { get { return false; } } public override bool IsGenericParameter { get { return true; } } public override int GenericParameterPosition { get { return m_type.GenericParameterPosition; } } public override bool ContainsGenericParameters { get { return m_type.ContainsGenericParameters; } } public override MethodBase DeclaringMethod { get { return m_type.DeclaringMethod; } } public override Type GetGenericTypeDefinition() { throw new InvalidOperationException(); } public override Type MakeGenericType(params Type[] typeArguments) { throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericTypeDefinition")); } protected override bool IsValueTypeImpl() { return false; } public override bool IsAssignableFrom(Type c) { throw new NotSupportedException(); } [System.Runtime.InteropServices.ComVisible(true)] public override bool IsSubclassOf(Type c) { throw new NotSupportedException(); } #endregion #region ICustomAttributeProvider Implementation public override Object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(); } public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(); } public override bool IsDefined(Type attributeType, bool inherit) { throw new NotSupportedException(); } #endregion #region Public Members public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { if (m_type.m_ca == null) m_type.m_ca = new ArrayList(); m_type.m_ca.Add(new TypeBuilder.CustAttr(con, binaryAttribute)); } public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { if (m_type.m_ca == null) m_type.m_ca = new ArrayList(); m_type.m_ca.Add(new TypeBuilder.CustAttr(customBuilder)); } public void SetBaseTypeConstraint(Type baseTypeConstraint) { m_type.CheckContext(baseTypeConstraint); m_type.SetParent(baseTypeConstraint); } [System.Runtime.InteropServices.ComVisible(true)] public void SetInterfaceConstraints(params Type[] interfaceConstraints) { m_type.CheckContext(interfaceConstraints); m_type.SetInterfaces(interfaceConstraints); } public void SetGenericParameterAttributes(GenericParameterAttributes genericParameterAttributes) { m_type.m_genParamAttributes = genericParameterAttributes; } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Reflection; using System.Reflection.Emit; using System.Collections; using System.Globalization; namespace System.Reflection.Emit { [System.Runtime.InteropServices.ComVisible(true)] public sealed class GenericTypeParameterBuilder: Type { #region Private Data Mebers internal TypeBuilder m_type; #endregion #region Constructor internal GenericTypeParameterBuilder(TypeBuilder type) { m_type = type; } #endregion #region Object Overrides public override String ToString() { return m_type.Name; } public override bool Equals(object o) { GenericTypeParameterBuilder g = o as GenericTypeParameterBuilder; if (g == null) return false; return g.m_type == m_type; } public override int GetHashCode() { return m_type.GetHashCode(); } #endregion #region MemberInfo Overrides public override Type DeclaringType { get { return m_type.DeclaringType; } } public override Type ReflectedType { get { return m_type.ReflectedType; } } public override String Name { get { return m_type.Name; } } public override Module Module { get { return m_type.Module; } } internal override int MetadataTokenInternal { get { return m_type.MetadataTokenInternal; } } #endregion #region Type Overrides public override Type MakePointerType() { return SymbolType.FormCompoundType("*".ToCharArray(), this, 0); } public override Type MakeByRefType() { return SymbolType.FormCompoundType("&".ToCharArray(), this, 0); } public override Type MakeArrayType() { return SymbolType.FormCompoundType("[]".ToCharArray(), this, 0); } public override Type MakeArrayType(int rank) { if (rank <= 0) throw new IndexOutOfRangeException(); string szrank = ""; if (rank == 1) { szrank = "*"; } else { for(int i = 1; i < rank; i++) szrank += ","; } string s = String.Format(CultureInfo.InvariantCulture, "[{0}]", szrank); // [,,] SymbolType st = SymbolType.FormCompoundType(s.ToCharArray(), this, 0) as SymbolType; return st; } public override Guid GUID { get { throw new NotSupportedException(); } } public override Object InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) { throw new NotSupportedException(); } public override Assembly Assembly { get { return m_type.Assembly; } } public override RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } } public override String FullName { get { return null; } } public override String Namespace { get { return null; } } public override String AssemblyQualifiedName { get { return null; } } public override Type BaseType { get { return m_type.BaseType; } } protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw new NotSupportedException(); } [System.Runtime.InteropServices.ComVisible(true)] public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr) { throw new NotSupportedException(); } protected override MethodInfo GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw new NotSupportedException(); } public override MethodInfo[] GetMethods(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override FieldInfo GetField(String name, BindingFlags bindingAttr) { throw new NotSupportedException(); } public override FieldInfo[] GetFields(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override Type GetInterface(String name, bool ignoreCase) { throw new NotSupportedException(); } public override Type[] GetInterfaces() { throw new NotSupportedException(); } public override EventInfo GetEvent(String name, BindingFlags bindingAttr) { throw new NotSupportedException(); } public override EventInfo[] GetEvents() { throw new NotSupportedException(); } protected override PropertyInfo GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) { throw new NotSupportedException(); } public override PropertyInfo[] GetProperties(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override Type[] GetNestedTypes(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override Type GetNestedType(String name, BindingFlags bindingAttr) { throw new NotSupportedException(); } public override MemberInfo[] GetMember(String name, MemberTypes type, BindingFlags bindingAttr) { throw new NotSupportedException(); } [System.Runtime.InteropServices.ComVisible(true)] public override InterfaceMapping GetInterfaceMap(Type interfaceType) { throw new NotSupportedException(); } public override EventInfo[] GetEvents(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override MemberInfo[] GetMembers(BindingFlags bindingAttr) { throw new NotSupportedException(); } protected override TypeAttributes GetAttributeFlagsImpl() { throw new NotSupportedException(); } protected override bool IsArrayImpl() { return false; } protected override bool IsByRefImpl() { return false; } protected override bool IsPointerImpl() { return false; } protected override bool IsPrimitiveImpl() { return false; } protected override bool IsCOMObjectImpl() { return false; } public override Type GetElementType() { throw new NotSupportedException(); } protected override bool HasElementTypeImpl() { return false; } public override Type UnderlyingSystemType { get { return this; } } public override Type[] GetGenericArguments() { throw new InvalidOperationException(); } public override bool IsGenericTypeDefinition { get { return false; } } public override bool IsGenericType { get { return false; } } public override bool IsGenericParameter { get { return true; } } public override int GenericParameterPosition { get { return m_type.GenericParameterPosition; } } public override bool ContainsGenericParameters { get { return m_type.ContainsGenericParameters; } } public override MethodBase DeclaringMethod { get { return m_type.DeclaringMethod; } } public override Type GetGenericTypeDefinition() { throw new InvalidOperationException(); } public override Type MakeGenericType(params Type[] typeArguments) { throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericTypeDefinition")); } protected override bool IsValueTypeImpl() { return false; } public override bool IsAssignableFrom(Type c) { throw new NotSupportedException(); } [System.Runtime.InteropServices.ComVisible(true)] public override bool IsSubclassOf(Type c) { throw new NotSupportedException(); } #endregion #region ICustomAttributeProvider Implementation public override Object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(); } public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(); } public override bool IsDefined(Type attributeType, bool inherit) { throw new NotSupportedException(); } #endregion #region Public Members public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { if (m_type.m_ca == null) m_type.m_ca = new ArrayList(); m_type.m_ca.Add(new TypeBuilder.CustAttr(con, binaryAttribute)); } public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { if (m_type.m_ca == null) m_type.m_ca = new ArrayList(); m_type.m_ca.Add(new TypeBuilder.CustAttr(customBuilder)); } public void SetBaseTypeConstraint(Type baseTypeConstraint) { m_type.CheckContext(baseTypeConstraint); m_type.SetParent(baseTypeConstraint); } [System.Runtime.InteropServices.ComVisible(true)] public void SetInterfaceConstraints(params Type[] interfaceConstraints) { m_type.CheckContext(interfaceConstraints); m_type.SetInterfaces(interfaceConstraints); } public void SetGenericParameterAttributes(GenericParameterAttributes genericParameterAttributes) { m_type.m_genParamAttributes = genericParameterAttributes; } #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
- ComboBoxHelper.cs
- Tablet.cs
- HashCodeCombiner.cs
- CustomValidator.cs
- TPLETWProvider.cs
- Label.cs
- Span.cs
- Transform3DGroup.cs
- SecurityRuntime.cs
- GeometryGroup.cs
- WebPartTransformer.cs
- ACL.cs
- TextDocumentView.cs
- Button.cs
- activationcontext.cs
- WebPartCatalogAddVerb.cs
- RenderData.cs
- CodeIndexerExpression.cs
- Table.cs
- ReverseInheritProperty.cs
- ControlBuilder.cs
- SchemeSettingElementCollection.cs
- ApplicationFileCodeDomTreeGenerator.cs
- WizardPanelChangingEventArgs.cs
- VisualTreeUtils.cs
- ButtonFieldBase.cs
- DBProviderConfigurationHandler.cs
- ConstNode.cs
- LineSegment.cs
- FilteredDataSetHelper.cs
- ClientConfigurationSystem.cs
- FormViewDeletedEventArgs.cs
- InstancePersistenceException.cs
- CopyOnWriteList.cs
- TrustSection.cs
- ArrayConverter.cs
- PrintDocument.cs
- Schema.cs
- JavaScriptObjectDeserializer.cs
- TdsParserStateObject.cs
- IisNotInstalledException.cs
- UserControl.cs
- NativeMethods.cs
- DocumentViewerHelper.cs
- PieceNameHelper.cs
- BlurEffect.cs
- SplitterCancelEvent.cs
- LinqDataSourceEditData.cs
- ApplicationFileParser.cs
- InternalBufferOverflowException.cs
- DataBindingHandlerAttribute.cs
- dbenumerator.cs
- BitmapCacheBrush.cs
- UnionExpr.cs
- XhtmlBasicTextBoxAdapter.cs
- SplayTreeNode.cs
- InvalidDataException.cs
- FlagPanel.cs
- ActiveDocumentEvent.cs
- EventLogTraceListener.cs
- ThreadStaticAttribute.cs
- ResourceSetExpression.cs
- Psha1DerivedKeyGenerator.cs
- AuthenticationException.cs
- TransformPattern.cs
- CompilerLocalReference.cs
- DrawingCollection.cs
- wgx_sdk_version.cs
- KeySplineConverter.cs
- XPathSingletonIterator.cs
- VectorCollectionValueSerializer.cs
- TypeDescriptor.cs
- MDIControlStrip.cs
- DataObject.cs
- OutOfProcStateClientManager.cs
- AutomationFocusChangedEventArgs.cs
- ContextDataSourceView.cs
- InheritablePropertyChangeInfo.cs
- ReverseQueryOperator.cs
- TextTreeUndoUnit.cs
- UpdatePanelTriggerCollection.cs
- IndexerNameAttribute.cs
- ContentType.cs
- ParseNumbers.cs
- XmlSignatureManifest.cs
- DefaultParameterValueAttribute.cs
- EntityDataSourceMemberPath.cs
- DecimalKeyFrameCollection.cs
- odbcmetadatacollectionnames.cs
- AssemblySettingAttributes.cs
- StorageTypeMapping.cs
- FlowDocumentPaginator.cs
- ItemCheckedEvent.cs
- Vector.cs
- NumericExpr.cs
- RNGCryptoServiceProvider.cs
- WindowsAuthenticationEventArgs.cs
- MediaTimeline.cs
- SeekableMessageNavigator.cs
- FontFamily.cs