استفاده از کلید برای گرفتن مقدار از generic Dictionary در #C
سلام بر تمامی برنامه نویسان سی شارپ 😉 در این مطلب ، استفاده از کلید برای گرفتن مقدار از generic Dictionary در سی شارپ #C رو براتون آماده کردم. انشاالله که این کد براتون مفید باشه.
خروجی پروژه به این صورت می باشد:
A, Salary: $7.00
B, Salary: $5.00
C, Salary: $4.00
D, Salary: $9.00
B, Salary: $5.00
C, Salary: $4.00
D, Salary: $9.00
استفاده از کلید برای گرفتن مقدار از generic Dictionary :
using System;
using System.Collections.Generic;
class MainClass {
public static void Main() {
Dictionary<string, double> dict = new Dictionary<string, double>();
// Add elements to the collection.
dict.Add("A", 7);
dict.Add("B", 5);
dict.Add("C", 4);
dict.Add("D", 9);
// Get a collection of the keys (names).
using System.Collections.Generic;
class MainClass {
public static void Main() {
Dictionary<string, double> dict = new Dictionary<string, double>();
// Add elements to the collection.
dict.Add("A", 7);
dict.Add("B", 5);
dict.Add("C", 4);
dict.Add("D", 9);
// Get a collection of the keys (names).