Skip to content

Instantly share code, notes, and snippets.

@efranford
Last active October 18, 2021 03:13
Show Gist options
  • Save efranford/71cc94c760b1472240116047289d890d to your computer and use it in GitHub Desktop.
Save efranford/71cc94c760b1472240116047289d890d to your computer and use it in GitHub Desktop.
LinqAllComparisonExample
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