Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

dictionary c#

// Create a dictionary with 2 string values
Dictionary<string, string> capitalOf = new Dictionary<string, string>();

// Add items to the dictionary
capitalOf.Add("Japan", "Tokio");
capitalOf.Add("Portugal", "Lissabon");

// Loop over the dictionary and output the results to the console
foreach (KeyValuePair<string, string> combi in capitalOf)
{
  Console.WriteLine("The capital of " + combi.Key + " is " + combi.Value);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# display a variable to a text gameobject 
Csharp :: move object to mouse unity 
Csharp :: time.timescale 
Csharp :: random unity 
Csharp :: How to add a label programatically in c# 
Csharp :: C# int.parse input string wasnt in correct format 
Csharp :: unity set list of strings 
Csharp :: convert string to array c# 
Csharp :: unity remove parent 
Csharp :: c# convert string to enum value 
Csharp :: c# throw exception 
Csharp :: stack to string c# 
Csharp :: c sharp array to list 
Csharp :: blazor option selected 
Csharp :: c# thread sleep vs task delay 
Csharp :: c# dictionary first 
Csharp :: unity dictionary check if key exists 
Csharp :: c# float to string with 2 decimals 
Csharp :: c# datetime to timestamp 
Csharp :: c# relative path to project folder 
Csharp :: how to spawn a object in unity 
Csharp :: jarray to list c# 
Csharp :: memset alternative in c# 
Csharp :: C# .net core convert string to enum 
Csharp :: c# number in range 
Csharp :: convert array object to int[] c# 
Csharp :: List string to file C# 
Csharp :: increase timeout in .net core web app 
Csharp :: create list with values c# 
Csharp :: asp.net core 3.1 ajax partial view 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =