Ana içeriğe atla

Widget With Options

 

Widget < TOptions > Generic Class

Bir widget bazı ek başlatma seçenekleri gerektiriyorsa sınıftan türetilmiş olabilir Widget< TOptions >.

Yapıcıya iletilen seçeneklere, korumalı alan aracılığıyla sınıf yöntemlerinde erişilebilir options.

public abstract class Widget< TOptions > : Widget
    where TOptions: class, new()
{
    protected Widget(jQueryObject element, TOptions opt = null) { ... }
    protected readonly TOptions options;
}