You could do something similiar to the image you showed with a bezier curve and a "bevel object" like so.
- Start by making the cross section of your fence
For this step I created the T shape you see above, then converted it from a mesh into a curve.
- Create a Bezier curve as the "Path" for the fence
As you can see here I made a curve, then added some points. I put all the control points flat like that to make sure the "top" of the fence didnt bend a ton but you can do it however you like
- Select the cross section as your Bevel object.
"Plane" was the name of my cross section so i just changed that. When I edit its shape, it automatically applies to the fence.
If you want to texture the "head" of the T and the body of the T Independantly you may have to duplicate / split up the bevel object because you have to apply the material to the curve object and not the bevel object.
If you want to do that you could make two seperate curves that occupy the same space, and split your cross section object into two pieces, assigning one cross section to each curve to allow them to have different shaders.