415
447
public override bool IsValueType {
417
return m_baseType != null && (
418
this.IsEnum || (m_baseType.FullName == Constants.ValueType && this.FullName != Constants.Enum));
449
return m_baseType != null && ((m_baseType.FullName == Constants.Enum) ||
450
(m_baseType.FullName == Constants.ValueType && this.FullName != Constants.Enum));
454
public new TypeDefinition DeclaringType {
455
get { return (TypeDefinition) base.DeclaringType; }
456
set { base.DeclaringType = value; }
422
459
internal TypeDefinition (string name, string ns, TypeAttributes attrs) :
459
501
nt.PackingSize = type.PackingSize;
462
foreach (FieldDefinition field in type.Fields)
463
nt.Fields.Add (FieldDefinition.Clone (field, context));
464
foreach (MethodDefinition ctor in type.Constructors)
465
nt.Constructors.Add (MethodDefinition.Clone (ctor, context));
466
foreach (MethodDefinition meth in type.Methods)
467
nt.Methods.Add (MethodDefinition.Clone (meth, context));
468
foreach (EventDefinition evt in type.Events)
469
nt.Events.Add (EventDefinition.Clone (evt, context));
470
foreach (PropertyDefinition prop in type.Properties)
471
nt.Properties.Add (PropertyDefinition.Clone (prop, context));
472
foreach (TypeReference intf in type.Interfaces)
473
nt.Interfaces.Add (context.Import (intf));
474
foreach (TypeDefinition nested in type.NestedTypes)
475
nt.NestedTypes.Add (Clone (nested, context));
476
foreach (CustomAttribute ca in type.CustomAttributes)
477
nt.CustomAttributes.Add (CustomAttribute.Clone (ca, context));
478
foreach (SecurityDeclaration dec in type.SecurityDeclarations)
479
nt.SecurityDeclarations.Add (SecurityDeclaration.Clone (dec));
504
if (type.HasFields) {
505
foreach (FieldDefinition field in type.Fields)
506
nt.Fields.Add (FieldDefinition.Clone (field, context));
508
if (type.HasConstructors) {
509
foreach (MethodDefinition ctor in type.Constructors)
510
nt.Constructors.Add (MethodDefinition.Clone (ctor, context));
512
if (type.HasMethods) {
513
foreach (MethodDefinition meth in type.Methods)
514
nt.Methods.Add (MethodDefinition.Clone (meth, context));
516
if (type.HasEvents) {
517
foreach (EventDefinition evt in type.Events)
518
nt.Events.Add (EventDefinition.Clone (evt, context));
520
if (type.HasProperties) {
521
foreach (PropertyDefinition prop in type.Properties)
522
nt.Properties.Add (PropertyDefinition.Clone (prop, context));
524
if (type.HasInterfaces) {
525
foreach (TypeReference intf in type.Interfaces)
526
nt.Interfaces.Add (context.Import (intf));
528
if (type.HasNestedTypes) {
529
foreach (TypeDefinition nested in type.NestedTypes)
530
nt.NestedTypes.Add (Clone (nested, context));
532
if (type.HasCustomAttributes) {
533
foreach (CustomAttribute ca in type.CustomAttributes)
534
nt.CustomAttributes.Add (CustomAttribute.Clone (ca, context));
536
if (type.HasSecurityDeclarations) {
537
foreach (SecurityDeclaration dec in type.SecurityDeclarations)
538
nt.SecurityDeclarations.Add (SecurityDeclaration.Clone (dec));
481
541
context.GenericContext.Type = contextType;