SORU
12 ŞUBAT 2009, PERŞEMBE


C bir dize bir işlevi çağırmadan#

Php gibi bir çağrı yapmak mümkün olduğunu biliyorum:

$function_name = 'hello';
$function_name();

function hello() { echo 'hello'; }

Bu mümkün .Net?

CEVAP
12 ŞUBAT 2009, PERŞEMBE


Evet. Yansıma kullanabilirsiniz. Şöyle bir şey:

Type thisType = this.GetType();
MethodInfo theMethod = thisType.GetMethod(TheCommandString);
theMethod.Invoke(this, userParameters);

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • DJAndrewRyan

    DJAndrewRyan

    22 Ocak 2007
  • MW Technology

    MW Technolog

    28 EKİM 2009
  • bored before i even began

    bored before

    30 Mart 2009