I'm a fan of AngleSharp. Here's a minimal example using your HTML snippet.
static void Main(string[] args)
{
var source = @"
<html>
<head>
</head>
<body>
<td class=""period_slot_1"">
<strong>TG</strong>
</body>
</html>";
var parser = new HtmlParser();
var document = parser.Parse(source);
var strong = document.QuerySelector("strong");
Console.WriteLine(strong.TextContent);
}
The QuerySelector() method takes a CSS selector, so you can of course select "strong" without difficulty.
If you're aiming to get data out of a table and the class matters, you can (again, using normal DOM from JavaScript you're likely used to) use the DOM and LINQ to project the classes and data, like
static void Main(string[] args)
{
var source = @"
<table>
<tr>
<td class=""period_slot_1"">
<strong>TG</strong>
</td>
<td class=""period_slot_2"">
<strong>TH</strong>
</td>
<td class=""period_slot_3"">
<strong>TJ</strong>
</td>
</tr>
<tr>
<td class=""period_slot_1"">
<strong>YG</strong>
</td>
<td class=""period_slot_2"">
<strong>YH</strong>
</td>
<td class=""period_slot_3"">
<strong>YJ</strong>
</td>
</tr>
</table>";
var parser = new HtmlParser();
var document = parser.Parse(source);
var strongs = document.QuerySelectorAll("td > strong")
.Select(x => new
{
Class = x.ParentElement.ClassName,
Data = x.TextContent
})
.OrderBy(x => x.Class);
strongs.ToList().ForEach(Console.WriteLine);
}
outputs:
{ Class = period_slot_1, Data = TG }
{ Class = period_slot_1, Data = YG }
{ Class = period_slot_2, Data = TH }
{ Class = period_slot_2, Data = YH }
{ Class = period_slot_3, Data = TJ }
{ Class = period_slot_3, Data = YJ }