I often read other people's code and once in a while, I saw some code added in a Designer file.
when I try to understand why some developers write code in a designer file, I often find myself arguing for hours with them.
Is there a Microsoft rule not to do it or is it open for anybody ?
The comment in the designer file should say enough:
This code is generated. Modifications will be lost when this code is regenerated.
Therefore, there is a risk: you can lose your modifications and / or additions.
Do note, some generators use
#region markup to mark what they will generate. For example LLBLgen. However usually these files are not named with
As for the discussion, a few arguments:
partial. So the class can be edited in the other file. If something in the designer file needs changes, best is to use the generator tool instead.