private void MapCustomAttributeArguments(CustomAttributeNamedArgumentCollection arguments, BuildType type) { for (int i = 0; i < arguments.Count; i++) { var argument = arguments[i]; switch (argument.Type) { case CustomAttributeNamedArgumentType.Field: { var field = type.Fields.Find(argument.Name) as BuildField; if (field != null) { UnstripAndEnqueue(field); } } break; case CustomAttributeNamedArgumentType.Property: { var property = type.Properties.Find(argument.Name) as BuildProperty; if (property != null) { UnstripAndEnqueue(property); } } break; default: throw new InvalidOperationException(); } } }
private void Process(CustomAttributeNamedArgumentCollection arguments, Module module) { foreach (var argument in arguments) { Process(argument, module); } }
private void MapCustomAttributeArguments( CustomAttributeNamedArgumentCollection arguments, BuildType type) { // Collect fields var fields = new Dictionary<string, BuildField>(); foreach (BuildField field in type.Fields) { if (!fields.ContainsKey(field.Name)) fields.Add(field.Name, field); } // Collect properties var properties = new Dictionary<string, BuildProperty>(); foreach (BuildProperty property in type.Properties) { if (!properties.ContainsKey(property.Name)) properties.Add(property.Name, property); } // Map for (int i = 0; i < arguments.Count; i++) { var argument = arguments[i]; switch (argument.Type) { case CustomAttributeNamedArgumentType.Field: { BuildField field; if (fields.TryGetValue(argument.Name, out field)) { if (MapCustomAttributeFieldArgument(ref argument, field)) { arguments[i] = argument; } } } break; case CustomAttributeNamedArgumentType.Property: { BuildProperty property; if (properties.TryGetValue(argument.Name, out property)) { if (MapCustomAttributePropertyArgument(ref argument, property)) { arguments[i] = argument; } } } break; default: throw new InvalidOperationException(); } } }