Here’s the function:
private static void AddToTree(TreeNode target, DataRow dataRow)
{
var node2 = new TreeNode(dataRow["name"].ToString())
{
ImageIndex = target.ImageIndex,
SelectedImageIndex = target.SelectedImageIndex,
Tag = dataRow
};
TreeNode node = node2;
target.Nodes.Add(node);
}
I see similar code throughout the codebase. Why not just add node2 to the target nodes and not create another variable? Am I missing something?
You’re not missing anything. This code is redudant.