using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _2019_05_14Exists
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
List<classMaterial> materialList = new List<classMaterial>();
materialList.Add(new classMaterial("lh", 22));
materialList.Add(new classMaterial("fb", 22));
materialList.Add(new classMaterial("lyf", 7));
if (materialList.Exists(tm => tm.name == "ff"))
{
}
}
}
internal class classMaterial
{
public classMaterial(string n, int i)
{
name = n;
age = i;
}
public string name;
public int age;
}
}