You must Sign In to post a response.
  • Category: ASP.Net MVC

    Use of Virtual keyword in methods

    Friends,

    Please explain the use of below code.
    Type 1:
    Public virtual async Task<ActionResult> methodname()
    {}

    Type 2:
    public virtual ActionResult methodname()
    {}

    why do we use public virtual what is the use?
  • #769613
    By default, methods are non-virtual. We can't override a non-virtual method.
    We can't use the virtual modifier with the static, abstract, private or override modifiers.

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


  • Sign In to post your comments