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
Post a Comment