Variant №1 1-masala


where n.Yoshi>=16 select new


Download 221.02 Kb.
bet3/4
Sana17.06.2023
Hajmi221.02 Kb.
#1531698
1   2   3   4
Bog'liq
Mustaqil ish 3

where n.Yoshi>=16
select new
{
ID=n.ID,
FIO=n.FIO,
Manzil=n.Manzil,
Yoshi=n.Yoshi,
GuruhID=n.GuruhID
};
jadval.ItemsSource=s;
}
}
}
Natija:


3-masala. 5 ta guruhdan va 10 ta talabadan iborat ro’yhat tuzing (Classlarning tarkibi 1-2-misollarda keltirilgan). Linq proeksiyalash so’rovi yordamida {ID, GuruhNomi, Yunalish, TalabaFIO, TalabaManzil } ustunlarga ega jadvalni chiqaruvchi dastur tuzing.
Masalaning C# dagi matni:

x:Class="M_ish_3.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="M_ish_3"
x:Name="Form"
Loaded="Form_Loaded"
Width="481"
Height="306">

Height="252"
Grid.Column="0"
Grid.Row="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Margin="5,5,5,5"
x:Name="jadval"
Loaded="jadval_Loaded" />


using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Linq;
namespace M_ish_3
{
public class Talaba
{
public int ID;
public string GuruhNomi;
public string Yunalish;
public string TalabaFIO;
public string TalabaManzil;

}
public partial class Window1 : Window


{
public Window1()
{
InitializeComponent();
a=new List();
}
Lista;
void Form_Loaded(object sender, RoutedEventArgs e)
{
a.Add(new Talaba{ID=1,GuruhNomi="21.06",Yunalish="Amaliy matematika",TalabaFIO="Abdujabborov D",TalabaManzil="Rishton tumani",});
a.Add(new Talaba{ID=2,GuruhNomi="21.06",Yunalish="Amaliy matematika",TalabaFIO="Odilov O",TalabaManzil="Chimyon tumani"});
a.Add(new Talaba{ID=3,GuruhNomi="21.01",Yunalish="Matematika",TalabaFIO="abdumannonova D",TalabaManzil="Rishton tumani"});
a.Add(new Talaba{ID=4,GuruhNomi="21.01",Yunalish="Matematika",TalabaFIO="Jakbarileva D",TalabaManzil="Rishton tumani"});
a.Add(new Talaba{ID=5,GuruhNomi="21.19",Yunalish="Psixologiya",TalabaFIO="Odilova A",TalabaManzil="Rishton tumani"});
a.Add(new Talaba{ID=6,GuruhNomi="21.19",Yunalish="Psixologiya",TalabaFIO="Ergashev Sh",TalabaManzil="Buvayda tumani"});
a.Add(new Talaba{ID=7,GuruhNomi="21.23",Yunalish="Geografiya",TalabaFIO="Halimov Y",TalabaManzil="Uchko'prik tumani"});
a.Add(new Talaba{ID=8,GuruhNomi="21.23",Yunalish="Geografiya",TalabaFIO="Hoshimov J",TalabaManzil="Beshariq tumani"});
a.Add(new Talaba{ID=9,GuruhNomi="21.55",Yunalish="Xorijiy til",TalabaFIO="Sheraliyev J",TalabaManzil="Oltiariq tumani"});
a.Add(new Talaba{ID=10,GuruhNomi="21.55",Yunalish="Xorijiy til",TalabaFIO="Muxtorov O",TalabaManzil="Uchko'prik tumani"});
}
void jadval_Loaded(object sender, RoutedEventArgs e)
{
var s=
from n in a
select new
{
ID=n.ID,
GuruhNomi=n.GuruhNomi,
Yunalish=n.Yunalish,
TalabaFIO=n.TalabaFIO,
TalabaManzil=n.TalabaManzil
};
jadval.ItemsSource=s;

}
}
}


Natija:



Download 221.02 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling