Confusion with UI text alignment in C#

I am trying to apply text alignment in C# by using something like this:

Text tx = butText.AddComponent<Text>();
tx.alignment = new TextAnchor.MiddleCenter();

However, there are no single example in Unity documentation about this, so I was trying various combinations, which I know from other cases. However none of them works. Does anyone know how to solve this? If so, could you also roughly explain in general how I can solve it next time if similar things would come up (i.e. differences between TextAnchor and textAnchor (if such one exists), etc.).

This works for me:

tx.alignment = TextAnchor.MiddleCenter;

While the new UI documentation is still lacking, I find the monodevelop text popups to come in handy somewhat. This is how I figured TextAnchor was an enum, so MiddleCenter is a value and not a function.