Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# get a value from value tuple list

// Using this extension method you can get the value you wish
static string GetAttributeValue(this IEnumerable<(string key, string value)> attributes, string attribute) =>
    attributes.Where(x => x.key == attribute).First().value;

// Obviously this does not work if you have multiple values that are the same
// So, NOTE that this assumes that you want to get the first occurance

// Usage:
List<(string, string)> values = new List<(string, string)>()
{ ("asd", "asd"), ("asd1", "asd1") };

string asdValue = values.GetAttributeValue("asd1");
// Output: asd1
Comment

PREVIOUS NEXT
Code Example
Csharp :: iframe set html content c# 
Csharp :: c# add strings 
Csharp :: c# destroy function...unity 
Csharp :: timer unity 
Csharp :: csharp csvhelper 
Csharp :: join dictionaries keys c# 
Csharp :: adding to a dictionary unity 
Csharp :: edit list element linq c# 
Csharp :: audio unity 
Csharp :: c# linq select specific columns 
Csharp :: for statement syntax C sharp 
Csharp :: c# .net automapper profile 
Csharp :: iterate through photon player gameobjects 
Csharp :: IsInstanceOf nunit 
Csharp :: unity dropdown 
Csharp :: indexof c# 
Csharp :: how to find the text position in excel in c# 
Csharp :: monogame button 
Csharp :: flat view player movement script 
Csharp :: serialize xml as array C# 
Csharp :: how to fill model enum with bradio button asp razor 
Csharp :: c# .net core entity framework one to many 
Csharp :: regex only letters and numbers c# 
Csharp :: serial begin 
Csharp :: caesar cipher in C# 
Csharp :: dictionary.add values to array c# 
Csharp :: tachyons 
Csharp :: C# Async Function simple 
Csharp :: long string c# 
Csharp :: c# datetime 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =