Saturday, June 28, 2014

C# Tutorial for Beginners 12 - Method Passing Parameters and Return







using System;
namespace MyProject.Examples
{
    class ExampleOne
    {
        public static void Main()
        {
            int num1 = 0, num2 = 0;
            //Accepting Values from users
            Console.Write("Enter first number\t\t");
            num1 = Convert.ToInt32(Console.ReadLine());

            Console.Write("\n\nEnter second number\t\t");
            num2 = Convert.ToInt32(Console.ReadLine());


                ExampleOne eOne=new ExampleOne();
                eOne.sum(num1, num2);
            
                Console.ReadKey();
        }

        public int sum(int no1,int no2)
        {
          
            int add = no1 + no2;
            return add;
            //
        }
    }
}
















------------------------------------

Passing Parameters C# Programming

C# Passing Parameters by Reference

How are parameters passed in C#?

ref (C# Reference)

Passing Reference-Type Parameters

Method Parameters (C# Reference)

Searches related to method parameters and return in c#

c# return multiple parameters

c# optional method parameters

c# method parameters array

c# method parameters optional

c# thread method with parameters

c# invoke method with parameters

c# get method parameters

c# default method parameters

No comments:

Post a Comment