How to test the shape is TextFrame

private void ClearAll(ref Slide slide)
{
for(int j = 0; j < slide.Shapes.Count; j++)
{

Shape shape = slide.Shapes[j];
// following method can work in old version, but it can’t work now.
// if (shape is TextFrame)
// {
// TextFrame tf = (TextFrame)shape;
// tf.Paragraphs[0].Portions[0].Text=" “;
//
// }

// i use try-catch because i am not sure all the shape can use this property.
try
{
shape.TextFrame.Paragraphs[0].Portions[0].Text=”";
}
catch{continue;}
}
}

//Can you tell me another best code to do this job

Dear Adam,

Shape shape = slode.Shapes[ j ];
if (shape.TextFrame != null)
{
TextFrame tf = shape.TextFrame;

}