コード例 #1
0
 /// <summary>
 /// Adds the definition of a constructor the type should implement.
 /// </summary>
 /// <param name="definition">Definition to add.</param>
 public void AddConstructorDefinition(ConstructorDefinition definition)
 {
     if (definition == null)
     {
         throw new ArgumentNullException(nameof(definition));
     }
     if (mConstructors.Contains(definition, ConstructorDefinition.SignatureEquality))
     {
         throw new CodeGenException("A constructor with the same signature is already part of the definition.");
     }
     mConstructors.Add(definition);
 }
コード例 #2
0
 /// <summary>
 /// When overridden in a derived class, adds code to a constructor of the type in creation.
 /// </summary>
 /// <param name="msil">IL Generator attached to the appropriate constructor.</param>
 /// <param name="definition">Definition of the constructor being implemented.</param>
 protected virtual void OnImplementConstructor(ILGenerator msil, ConstructorDefinition definition)
 {
 }
コード例 #3
0
 /// <summary>
 /// Is called by <see cref="CodeGenEngine"/> to add code to a constructor.
 /// </summary>
 /// <param name="msil">IL Generator attached to the appropriate constructor.</param>
 /// <param name="definition">Definition of the constructor being implemented.</param>
 void ICodeGenModule.ImplementConstruction(ILGenerator msil, ConstructorDefinition definition)
 {
     OnImplementConstructor(msil, definition);
 }
コード例 #4
0
 /// <summary>
 /// Adds code to a constructor of the type in creation calling the <see cref="ImplementConstructor"/> callback.
 /// </summary>
 /// <param name="msil">IL Generator attached to the appropriate constructor.</param>
 /// <param name="definition">Definition of the constructor being implemented.</param>
 protected override void OnImplementConstructor(ILGenerator msil, ConstructorDefinition definition)
 {
     ImplementConstructor?.Invoke(this, msil, definition);
 }