小编Chr*_*lds的帖子

为什么我不能在C#中的另一个类的DateTime对象上调用DateTime方法

我已经在其他语言中找到了一些这个问题的例子,例如ruby或php,它们似乎表明我需要某种包含来支持这个但我无法弄清楚它.

我有:

private void setLoansView(Member _member)
{

    foreach (Loan loan in _member.Loans)
        {
            this.dt.Rows.Add(_member.Name, // dt is a datatable 
                   loan.BookOnLoan.CopyOf.Title, 
                   loan.TimeOfLoan.ToShortDateString(), 
                   loan.DueDate.ToShortDateString(), 
                   loan.TimeReturned.ToShortDateString());
        }
Run Code Online (Sandbox Code Playgroud)

贷款看起来像这样:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace Library.Entities
{
    public class Loan
    {
        [Key]
        public int LoanId { get; set; }
        [Required]
        public DateTime? TimeOfLoan { get; set; }
        public DateTime? DueDate { get; set; }
        public DateTime? TimeReturned { get; set; }
        [Required]
        public Copy BookOnLoan { get; set; } …
Run Code Online (Sandbox Code Playgroud)

c# datetime icollection

1
推荐指数
1
解决办法
211
查看次数

标签 统计

c# ×1

datetime ×1

icollection ×1