گرفتن تمام مقدارهای IDictionary و انجام عملیات روی آن ها در #C
سلام بر تمامی برنامه نویسان سی شارپ 😉 در این مطلب ، گرفتن تمام مقدارهای IDictionary و انجام عملیات روی آن ها در سی شارپ #C رو براتون آماده کردم. انشاالله که این کد براتون مفید باشه.
این کد تمامی مقدارهای دیکشنری را با هم جمع می کند و مقدار به دست آمده را به کاربر نمایش می دهد.
خروجی پروژه به این صورت می باشد:
$101.49
گرفتن تمام مقدارهای IDictionary و انجام عملیات روی آن ها :
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
public class MainClass
{
public static void Main()
{
IDictionary<string, decimal> salaryMap = new Dictionary<string, decimal>();
salaryMap.Add("S", 60.5M);
salaryMap.Add("W", 10.0M);
salaryMap.Add("J", 30.99M);
decimal total = 0.0M;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
public class MainClass
{
public static void Main()
{
IDictionary<string, decimal> salaryMap = new Dictionary<string, decimal>();
salaryMap.Add("S", 60.5M);
salaryMap.Add("W", 10.0M);
salaryMap.Add("J", 30.99M);
decimal total = 0.0M;