Unity 4.6: How to add child to canvas in C#

I started to work with new Unity 4.6 UI and already building custom menus. But I faced difficulties to add new gameobjects into canvas for new UI system. When I am using:

parent = this.gameObect;
child = new GameObject("child");

child.transform.parent = parent.transform;

it creates empty game object and attaches to canvas gameobject, which is parent. But it creates with regular component attached, not recttransform, which I need to be on this object. How I can create new child object for canvas with recttransform attached and ready to add buttons and other UI stuff?

Add a RectTransform component, either in the GameObject constructor, or afterward by using AddComponent. The only component any GameObject ever has by default is Transform; if you need others then you have to add them yourself.