how to disable all other components in gameobject in unity

Code Example - how to disable all other components in gameobject in unity

                
                        foreach (MonoBehaviour component in GetComponents<MonoBehaviour>())
{	
	if (component != this) component.enabled = false;
}