コード例 #1
0
ファイル: ClassBuilder.cs プロジェクト: n-stuff/window-system
 /// <summary>
 /// Adds a method to the class.
 /// </summary>
 /// <typeparam name="TDelegate">The delegate type of the method.</typeparam>
 /// <param name="selector">The selector identifying the method.</param>
 /// <param name="implementation">The delegate used as the body of the method.</param>
 /// <param name="types">The Objective C runtime argument types string.</param>
 /// <returns><c>true</c> if the method was successfully added.</returns>
 /// <remarks>The <paramref name="implementation"/> value should be stored to avoid garbage collection.</remarks>
 public bool AddMethod <TDelegate>(SEL selector, TDelegate implementation, string types) where TDelegate : class =>
 class_addMethod(NewClass.Handle, selector.Handle, Marshal.GetFunctionPointerForDelegate(implementation), types);
コード例 #2
0
 /// <summary>
 /// Sends a message to <paramref name="receiver"/>.
 /// </summary>
 /// <param name="receiver">The target of the message.</param>
 /// <param name="selector">The selector identifying the message.</param>
 /// <returns>An <see cref="Id"/>.</returns>
 public static Id Get(this IReceiver receiver, SEL selector) =>