什么冒号(:))是指在C#中定义类? [英] What colon ( : ) means defining a class in c#?

查看:995
本文介绍了什么冒号(:))是指在C#中定义类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#中定义一个类有哪些呢表示

In c# defining a class what does : means?

为例,在ASP.NET MVC应用程序的这个非常基本的控制器:

As example, in this very basic controller of an ASP.NET MVC application:

namespace App.Controllers
{
    public class HomeController : Controller
    {    
        public ActionResult Index()
        {
            return View();
        }
    }
}

在第三行,什么是:控制器表示

推荐答案

在此情况下,它意味着的HomeController 继承了控制器类。

In this case it means that the HomeController inherits the Controller class.

您可以阅读关于继承这里更多的细节,但简单地说 - 继承意味着一切一个控制器是一个的HomeController 是也。 A 的HomeController 是一个更细粒度控制器类。

You can read more details about inheritance here, but simply put - inheritance means that everything a Controller is, a HomeController is also. A HomeController is a more finely grained Controller class.

它也可用于实施接口<一href=\"http://msdn.microsoft.com/en-us/library/ms173156.aspx\">http://msdn.microsoft.com/en-us/library/ms173156.aspx

这篇关于什么冒号(:))是指在C#中定义类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆