با سلام خدمت دوستان عزیزم ،
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); } } }
این پست در تاریخ {{ dateString(new Date(post.deleteDate)) }} توسط {{ post.deletedByUser }} حذف شده است.
دلیل حذف: {{ post.deleteReason ?? 'نامشخص' }}
زمان پاسخ گویی روز های شنبه الی چهارشنبه ساعت 9 الی 18
فقط به موضوعات مربوط به محصولات آموزشی و فروش پاسخ داده می شود