Hi @Priyanka12,
Of course you can do the coding in .cs even it is master page.
It is also a class file.
Coding on master page depends on the situation.
Lets have an example.
Suppose you have a label and you want to show current date time on this label.
It should be available to all the pages which is inheriting this master page.
So simply you can set this label on page load of master page.
Like this
protected void(object sender,Event Args e){
this.lblDate = DateTime.Now.ToString();
}
Html
<asp:Label ID="lblDate" runat="server"></asp:Label>
so it depends that what functionality do you want to write their.
If any confusion revert on the same