【发布时间】:2013-11-14 15:12:59
【问题描述】:
我是 C# 新手,如有错误请纠正我
我正在尝试创建一个具有 Nullable 属性的类,但它在构建我的类看起来像的类时出错
public class vwAcdAdmissionWithvwAcdAdmissionSessionDetailWithAllMaster1
{
public Nullable<string> Name { get; set; }
public Nullable<string> StudentNameWithLedgerName { get; set; }
public Nullable<decimal> AASDid { get; set; }
public Nullable<decimal> StudentLedgerId { get; set; }
public Nullable<string> LedgerName { get; set; }
public Nullable<decimal> SessionId { get; set; }
public Nullable<string> ScholarNo { get; set; }
public Nullable<decimal> ClassId { get; set; }
public Nullable<decimal> SectionId { get; set; }
public Nullable<decimal> MediumId { get; set; }
public Nullable<decimal> StreamId { get; set; }
public Nullable<decimal> HouseId { get; set; }
public Nullable<decimal> FeeCategoryId { get; set; }
public Nullable<decimal> SchemeId { get; set; }
public Nullable<decimal> RollNo { get; set; }
public Nullable<decimal> SchoolId { get; set; }
public Nullable<decimal> UserId { get; set; }
public Nullable<decimal> ShiftId { get; set; }
public Nullable<string> StreamName { get; set; }
public Nullable<string> ClassName { get; set; }
public Nullable<string> HouseName { get; set; }
public Nullable<string> SectionName { get; set; }
public Nullable<string> ShiftName { get; set; }
public Nullable<string> MediumName { get; set; }
public Nullable<string> FeeCategoryName { get; set; }
public Nullable<string> DiscountType { get; set; }
public Nullable<decimal> Discount { get; set; }
}
错误是错误是 The type 'string' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'System.Nullable<T>'
我不明白这是什么意思,我现在能做什么
请建议我,并感谢您的宝贵意见
我想让我的字符串可以为空的原因类似于我以前的帖子
last post
返回不可为空的字符串时会出错
【问题讨论】:
-
这是一个巨大的类名:)