Mono.CSharp.Struct.ApplyAttributeBuilder C# (CSharp) Method

ApplyAttributeBuilder() public method

public ApplyAttributeBuilder ( Attribute a, MethodSpec ctor, byte cdata, Mono.CSharp.PredefinedAttributes pa ) : void
a Attribute
ctor MethodSpec
cdata byte
pa Mono.CSharp.PredefinedAttributes
return void
		public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
		{
			base.ApplyAttributeBuilder (a, ctor, cdata, pa);

			//
			// When struct constains fixed fixed and struct layout has explicitly
			// set CharSet, its value has to be propagated to compiler generated
			// fixed types
			//
			if (a.Type == pa.StructLayout && Fields != null) {
				var value = a.GetNamedValue ("CharSet");
				if (value == null)
					return;

				for (int i = 0; i < Fields.Count; ++i) {
					FixedField ff = Fields [i] as FixedField;
					if (ff == null)
						continue;

					ff.CharSet = (CharSet) System.Enum.Parse (typeof (CharSet), value.GetValue ().ToString ());
				}
			}
		}