Esempio n. 1
0
		static void PatchStaticConstructor (TypeDefinition type, HashSet<FieldDefinition> selectors)
		{
			var cctor = type.GetTypeConstructor ();
			if (cctor == null || !cctor.HasBody)
				return;

			var instructions = cctor.Body.Instructions;

			for (int i = 0; i < instructions.Count; i++) {
				var instruction = instructions [i];
				if (!IsCreateSelector (instruction, selectors))
					continue;

				instructions.RemoveAt (i--);
				instructions.RemoveAt (i--);
				instructions.RemoveAt (i--);
			}
		}
Esempio n. 2
0
		MethodDefinition GetTypeConstructor (TypeDefinition type)
		{
			return type.GetTypeConstructor () ?? CreateTypeConstructor (type);
		}