به نام خدا سلام بر برنامه نویسان عزیز 😉 در این پست کد شمارش تعداد عناصر List در یک بازه با متد Range و Count در #C را آماده کردم. امیدوارم که این کد برای شما مفید باشد.
کد شمارش تعداد عناصر List در یک بازه با متد Range و Count در #C :
using System;
using System.Collections.Generic;
using System.Linq;
class Item{
public int Width { get; set; }
public int Length { get; set; }
public override string ToString(){
return string.Format("Width: {0}, Length: {1}", Width, Length);
}
}
class MainClass{
static void Main(string[] args){
List items = new List{
new Item { Length = 0, Width = 5 },
new Item { Length = 1, Width = 6 },
new Item { Length = 2, Width = 7 },
new Item { Length = 3, Width = 8 },
new Item { Length = 4, Width = 9 }
};
using System.Collections.Generic;
using System.Linq;
class Item{
public int Width { get; set; }
public int Length { get; set; }
public override string ToString(){
return string.Format("Width: {0}, Length: {1}", Width, Length);
}
}
class MainClass{
static void Main(string[] args){
List items = new List{
new Item { Length = 0, Width = 5 },
new Item { Length = 1, Width = 6 },
new Item { Length = 2, Width = 7 },
new Item { Length = 3, Width = 8 },
new Item { Length = 4, Width = 9 }
};