c# - VS does not allow me to invoke my extension method -


for reason, vs allows me use long writing of extension method invocation. compiler rejects shorter form:

public static class operationextender {

public static void mymethod(operation ope, int value) {   ... } 

}

i can invoke way:

operationextender.mymethod(anoperation, 0); 

but if type:

anoperation.operationextender(0); 

vs generates usual comilation error:

 'operationextender.mymethod(operation, int)'   not contain definition 'mymethod' , no extension method 'mymethod' accepting first argument of type 'operation' found (are missing using directive or assembly reference?) 

if first writing accepted, suppose cannot usung/ns/assembly issue....

because it's not extension method. forgot this keyword on first parameter (the type being "extended"):

public static void mymethod(this operation ope, int value) {     //... } 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -