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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -