c# - Cannot implicitly convert type delegate to string -


i'm trying create class @ runtime can pointed various data inputs. trying use delegates. have worker method returns string (in actual implementation, there others choose from). return value of delegate returned method exposed rest of code.

private delegate string delmethod(); private static delmethod pntr_method = new delmethod(onedelegatemethod);  public static string exposedmethod() {     return pntr_method; } public static string onedelegatemethod() {     return "this string"; } 

i'm getting error

cannot implicitly convert type 'ob.database.delmethod' 'string'

i'm puzzled why this, when method has worked bools , idatareaders.

if want call delegate , return value, have use "()":

public static string exposedmethod() {     return pntr_method(); } 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -