Error در asp.net

بپرسید

0

{{ digitTrunc(content.likes) }}

با سلام خدمت دوستان عزیزم ،

Error 1 'Products': member names cannot be the same as their enclosing type D:\drive d\bootstrap\Mvc-DotNetj7\Mvc-DotNetj7\Models\Products.cs 10 22 Mvc-DotNetj7

دلیل این error چیه ؟

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Mvc_DotNetj7.Models;
namespace Mvc_DotNetj7.Models
{
    public class Products
    {
        public class Products : List<Product>
        {
            public Products()
            {
                this.Add(new Product("D123", "Super Fast Bike", 1000M));
                this.Add(new Product("A356", "Durable Helmet", 123.45M));
                this.Add(new Product("M924", "Soft Bike Seat", 34.99M));
                
                
            }
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Mvc_DotNetj7.Models
{
    public class Product
    {
        public Product(string productNumber, string name, decimal price)
        {
            Name = name;
            Price = price;
            ProductNumber = productNumber;
        }
        public string ProductNumber { get; set; }
        public string Name { get; set; }
        public decimal Price { get; set; }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_DotNetj7.Models;
namespace Mvc_DotNetj7.Controllers
{
    public class ProductsController : Controller
    {
        //
        // GET: /Products/
        public ActionResult Index()
        {
            var products=new Products();
            return View(products);
        }
	}
}
دوره های شبکه، برنامه نویسی، مجازی سازی، امنیت، نفوذ و ... با برترین های ایران

پاسخ ها به این سوال

پاسخ ها به این سوال

{{ digitTrunc(post.likes) }}

این پست در تاریخ {{ dateString(new Date(post.deleteDate)) }} توسط {{ post.deletedByUser }} حذف شده است.

دلیل حذف: {{ post.deleteReason ?? 'نامشخص' }}

{{ err }}
{{ post.userAchivements.rhodiumAchievements }}
{{ post.userAchivements.platinumAchievements }}
{{ post.userAchivements.goldAchievements }}
{{ post.userAchivements.silverAchievements }}
{{ post.userAchivements.bronzeAchievements }}
{{ timeSince(new Date(post.date)) }} قبل

برای ثبت پاسخ خود در وب سایت وارد حساب کاربری خود شوید
قابلیت ارسال مطلب توسط مدیریت سایت غیر فعال شده است