return statement exits the method and must return an expression of the method's return type if the method is nonvoid: - CSharp Custom Type

CSharp examples for Custom Type:Method

Introduction

A return statement can appear anywhere in a method except in a finally block.

Demo Code

using System;/*from   w  w  w. j a  va 2s  . c o m*/
class Test
{
    static decimal AsPercentage(decimal d)
    {
        decimal p = d * 100m;
        return p;             // Return to the calling method with value
    }
    static void Main()
    {
        Console.WriteLine(AsPercentage((decimal)0.1));
    }
}

Result


Related Tutorials