c# - Add attribute to method without modifying the code file containing the method? -


is there way add attribute method without modifying class file?

e.g. i'm importing wsdl generates reference.cs containing proxy class methods.

i have written attribute work me , adding method below, , works fine:

reference.cs file

public partial class whatever {     [mycustomattrubute()]     public void mymethod(string bleh)     {         // stuff         return;     } } 

however, problem if wsdl changes need update it, automatically lose changes reference.cs. can add attribute method file?

if other method string, can not concatenate other method this? in other words when call mymethod(string bleh), pass 2 strings concatenated it.

for example: mymethod(string1 + "|" + string2);

this pass 2 parameters concatenated pipe, in method can use

string[] vals = val.split('|');

which give array of parameters passed. way pass more 2 parameters through.

then parameters as:

sting para1 = vals[0]; sting para2 = vals[1];


Comments

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

SQL Server - MyCTE query based on 24 hour period (next day) -

php - Using str_replace to translate a MySQL Table in html -