469,658 Members | 1,791 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,658 developers. It's quick & easy.

App_Code Class Help: good practice

Hello,

I created a class (public class General) with the following. My question
is, is this good practice to have a group of methods(?) in one class, or
should I have a separate class for each method? I'm not sure if this makes
sense, but can/should you put more than one class in a file (myclasses.cs)?
Any help would be appreciated...

Thanks, sck10
public class General
{

public void HidePanels(Page MyPage)
{
// my code
}

public void SetFocusControl(Control FocusControl)
{
// my code
}

public string ClearCell(object RepeaterValue, string CompareValue)
{
// my code
}

protected void SendMail(string From, string To, string Subject, string Body,
string Client)
{
// my code
}

}
Aug 13 '06 #1
2 1779
Hello Steve,

Since the class in your case is a small helper class specific to the
ASP.NET application(you put it in App_Code directory), you can simply put
those methods within one class. Also, using mutiple classes to group
methods of different categories should be a good practice, for your
scenario, you can group those helper methods which perform control
collection manipulation into a single class.. And of course, you can put
multiple classes in single code file if they have the similar functions.

If you want to design some formal and reusable class library components,
you can consider following some more detailed coding and designing
guideline and best practices. Here is a web article on C# coding style
guide:

#C# Coding Style Guide
http://www.csharpfriends.com/Article...?articleID=336

BTW, if you have interests, you can have a look at the following book which
is recommended by many developers for .net class library and framework
designing(I've bought one myself :-)):

#Framework Design Guidelines
http://www.amazon.com/gp/product/032...2?v=glance&n=2
83155

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 14 '06 #2
Thanks Steven,

Appreciate the info and I'll have to check out the book you recommended...
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:o2**************@TK2MSFTNGXA01.phx.gbl...
Hello Steve,

Since the class in your case is a small helper class specific to the
ASP.NET application(you put it in App_Code directory), you can simply put
those methods within one class. Also, using mutiple classes to group
methods of different categories should be a good practice, for your
scenario, you can group those helper methods which perform control
collection manipulation into a single class.. And of course, you can put
multiple classes in single code file if they have the similar functions.

If you want to design some formal and reusable class library components,
you can consider following some more detailed coding and designing
guideline and best practices. Here is a web article on C# coding style
guide:

#C# Coding Style Guide
http://www.csharpfriends.com/Article...?articleID=336

BTW, if you have interests, you can have a look at the following book
which
is recommended by many developers for .net class library and framework
designing(I've bought one myself :-)):

#Framework Design Guidelines
http://www.amazon.com/gp/product/032...2?v=glance&n=2
83155

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by dm1608 | last post: by
5 posts views Thread by sck10 | last post: by
4 posts views Thread by sck10 | last post: by
2 posts views Thread by pradeep_TP | last post: by
9 posts views Thread by rn5a | last post: by
4 posts views Thread by =?Utf-8?B?YWNjZXNzaW5nIEMjIGNsYXNzZXMgaW4gQXBwX0Nv | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.