/// <see cref="MarkupExtension.ProvideValue"/> public override object ProvideValue(IServiceProvider serviceProvider) { TypeArguments.Add(TypeArgument); ConstructorArguments.Add(App.Container); ConstructorArguments.Add(Name); return(base.ProvideValue(serviceProvider)); }
void CreateArguments() { int count = Constructor == null ? 0 : Constructor.MethodSig.GetParamCount(); while (ConstructorArguments.Count > count) { ConstructorArguments.RemoveAt(ConstructorArguments.Count - 1); } while (ConstructorArguments.Count < count) { var type = Constructor.MethodSig.Params[ConstructorArguments.Count]; ConstructorArguments.Add(new CAArgumentVM(ownerModule, CreateCAArgument(type), new TypeSigCreatorOptions(ownerModule, language), type)); } }
void InitializeFrom(CustomAttributeOptions options) { IsRawData = options.RawData != null; RawData.Value = options.RawData; Constructor = options.Constructor; ConstructorArguments.Clear(); var sig = Constructor == null ? null : Constructor.MethodSig; for (int i = 0; i < options.ConstructorArguments.Count; i++) { TypeSig type = null; if (sig != null && i < sig.Params.Count) { type = sig.Params[i]; } ConstructorArguments.Add(new CAArgumentVM(ownerModule, options.ConstructorArguments[i], new TypeSigCreatorOptions(ownerModule, language), type)); } CANamedArgumentsVM.InitializeFrom(options.NamedArguments); CreateArguments(); }