在非抽象C#类Bodyless构造 [英] Bodyless constructor in non-abstract C# class

查看:99
本文介绍了在非抽象C#类Bodyless构造的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解的MVC框架提供了以下类;它似乎像类应该是抽象的,但它不是,但这个类编译。是类,尽管缺少的抽象的关键字实际上抽象?缺少什么我在这里?

I'm trying to understand the following class provided in the MVC framework; it seems like the class should be abstract, but it is not, and yet this class compiles. Is the class actually abstract despite the missing "abstract" keyword? What am I missing here?

namespace Microsoft.AspNet.Identity.EntityFramework
{
    public class IdentityUser : IUser
    {
        public IdentityUser();
        public IdentityUser(string userName);

        public virtual ICollection<IdentityUserClaim> Claims { get; }
        public virtual string Id { get; set; }
        public virtual ICollection<IdentityUserLogin> Logins { get; }
        public virtual string PasswordHash { get; set; }
        public virtual ICollection<IdentityUserRole> Roles { get; }
        public virtual string SecurityStamp { get; set; }
        public virtual string UserName { get; set; }
    }
}



编辑:

教训:如果没有提供一个二进制源,使用转到定义在Visual Studio将提供的东西,看起来像大部分源代码,...这是比使用打开声明在Eclipse中,它会告诉你的东西,真的不像来源不同。

Lesson learned: if there is no source provided for a binary, using "Go To Definition" in Visual Studio will provide something that looks mostly like source code... which is different than using "Open Declaration" in Eclipse, which will show you something that really doesn't look like source.

推荐答案

这是微软的,我想你在Visual Studio中检索到的代码由转到定义上下文菜单类。通过反映在类型生成此代码自动,并且只为了显示声明,而不是执行的内容。如果您使用.NET Refector或dotReflect工具,那么你会看到执行机构。

This is a Microsoft's class which I presume you retrieved the code for by "Go to Definition" context menu in Visual Studio. This code is auto generated by reflecting over the type, and only is meant to show declarations and not the implementation content. If you use .NET Refector or dotReflect tools, then you'll see body of the implementation.

这篇关于在非抽象C#类Bodyless构造的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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