Is eating before going to bed unhealthy? what foods to avoid?

Is eating before going to bed really unhealthy? Will you immediately gain weight by just one snack just because you ate at the wrong time?