unity get all children

C#
foreach (Transform child in parent) {
  //Your code
}foreach (Transform child in transform)     GameObject Child;
Child = transform.GetChild(0).gameObject;    public List<GameObject> childrens = new List<GameObject>();

    void Update()
    {
      foreach (Transform child in transform)
      {           
          if (!childrens.Contains(child.gameObject))
          {
              childrens.Add(child.gameObject);
          }                            
      }
    }
Source

Also in C#: