Last active
October 18, 2021 03:13
-
-
Save efranford/71cc94c760b1472240116047289d890d to your computer and use it in GitHub Desktop.
LinqAllComparisonExample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using System.Text; | |
using UnityEngine; | |
using System.Linq; | |
public class LinqAllComparisonExample : MonoBehaviour | |
{ | |
void Start() | |
{ | |
List<string> characterAttributes = new List<string>() { "strength", "dex", "constitution" }; | |
List<string> requiredAttributes = new List<string>() { "dex", "constitution" }; | |
bool hasAttributes = requiredAttributes.All(required => characterAttributes.Contains(required)); | |
Debug.Log($"Required attribues exist on the character's attributes? hasAttributes={hasAttributes}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment