c#.net function -
namespace csfunction { class program { static void main(string[] args) { public int addnumbers(int number1, int number2) { int result = addnumbers(10, 5); console.writeline(result); } } } } is code...am getting error like.....error type or namespace definition, or end-of-file expected
..hw can on come error
you defining method inside method, , not allowed in c#.
change this:
namespace csfunction { class program { static void main(string[] args) { } public static int addnumbers(int number1, int number2) { int result = addnumbers(10, 5); console.writeline(result); } } } then if want call addnumbers main, add following line inside main
addnumbers( 10, 5); also note not using parameters inside addnumbers anything. method should this:
public int addnumbers(int number1, int number2) { int result = number1 + number2; console.writeline(result); } in it's current form it's calling recursively also, , go endless loop.
so basically, there tons of problems code. should try entry level book on c# brush on c# skills.
Comments
Post a Comment