Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
903 views
in Technique[技术] by (71.8m points)

visual studio - Role of Designer.cs File in c#

I am getting Designer.cs file in my project and the comment in the file says it is being generated by an automatic tool.

This was an existing project so I don't know much about that. It is generated for one schema.cs which consists of schemas of all the tables in Database.

I am using a SQLIte DB. Can any one help me in understanding what is the use of the Designer.cs file in a C# project.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There are lots of kinds of Designer.cs files in a Visual Studio project. Common ones are:

  • PropertiesResources.resxResources.Designer.cs file, the auto-generated code from adding resources to the Project + Resources tab
  • PropertiesSettings.settingsSettings.Designer.cs file, the auto-generated code from adding settings to the Project + Settings tab
  • SomeForm.csSomeForm.Designer.cs, the auto-generated code produced by the Winforms designer from the controls you drop on a form
  • SomeData.xsdSomeData.Designer.cs, the auto-generated code produced by the dataset designer.

Given that you name a database in your question it is somewhat likely that you are talking about the last one. You ought to see the pattern from the descriptions, you use a visual designer gadget in Visual Studio and it produces C# code that does something useful at runtime. You go back from the Designer.cs to the designer gadget by double-clicking its parent node in the Solution Explorer window. Don't ever edit the Designer.cs file, you'll lose everything when the designer re-generates the code. They are somewhat hidden in the Solution Explorer for that reason. If you haven't found them yet: open the nodes to see them.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...