public TypeDefOrRefAndCAVM(TypeDefOrRefAndCAOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.origOptions = options; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) { typeSigCreatorOptions.CanAddGenericMethodVar = true; } this.typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); TypeSigCreator.PropertyChanged += TypeSigCreator_PropertyChanged; this.customAttributesVM = new CustomAttributesVM(ownerModule, language); Reinitialize(); }
TypeDefOrRefAndCAOptions CopyTo(TypeDefOrRefAndCAOptions options) { options.TypeDefOrRef = TypeSigCreator.TypeSig.ToTypeDefOrRef(); options.CustomAttributes.Clear(); options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create())); return(options); }
public TypeDefOrRefAndCAVM(TypeDefOrRefAndCAOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.origOptions = options; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) typeSigCreatorOptions.CanAddGenericTypeVar = false; if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) typeSigCreatorOptions.CanAddGenericMethodVar = true; this.typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); TypeSigCreator.PropertyChanged += TypeSigCreator_PropertyChanged; this.customAttributesVM = new CustomAttributesVM(ownerModule, language); Reinitialize(); }
void InitializeFrom(TypeDefOrRefAndCAOptions options) { TypeSigCreator.TypeSig = options.TypeDefOrRef.ToTypeSig(); CustomAttributesVM.InitializeFrom(options.CustomAttributes); }
TypeDefOrRefAndCAOptions CopyTo(TypeDefOrRefAndCAOptions options) { options.TypeDefOrRef = TypeSigCreator.TypeSig.ToTypeDefOrRef(); options.CustomAttributes.Clear(); options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create())); return options; }