473,320 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 1875
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jay Douglas | last post by:
I have a set of pages that inherit from a base class in the App_Code folder. The class looks something like: public class MyBaseClass : System.Web.UI.Page In various stages of the life cycle I...
0
by: dm1608 | last post by:
Hello -- I'm trying to rewrite a few simple ASP pages that I have to use ASP.NET 2.0. One of the nice things I see that I can do now is separate my Business Logic layer and Data Access Layer...
2
by: walter | last post by:
Hi, when I add a new page in my asp.net 2 project and put some controls there, everything works fine until I move the code behind into App_Code folder.--When I compile , it tells me that control...
5
by: sck10 | last post by:
Hello, I am trying to add the following to a App_Code class. The error I am getting references "Page.Controls". I would like to call this from my content page which uses MasterPages I read...
4
by: sck10 | last post by:
Hello, I am trying to get the Month from the following using "switch" in my App_Code file. The error that I am getting is: An object reference is required for the nonstatic field, method, or...
2
by: pradeep_TP | last post by:
Hello, I am trying to use APP_CODE folder for all my class files under VS 2005. After adding APP_CODE in the solution explorer, I added a new web page by right clicking project and selecting add...
9
by: rn5a | last post by:
Is putting a VB class file in the special directory named App_Code the same as relocating the VB class file from the App_Code directory to another directory & then using the VBC tool, compiling the...
4
by: =?Utf-8?B?YWNjZXNzaW5nIEMjIGNsYXNzZXMgaW4gQXBwX0Nv | last post by:
I've a simple aspx page whose code behind instantiates a simple class which exists in a .cs file in the App_Code folder of my project. Runs fine in the IDE. When I copy the app to my IIS server I...
5
by: Randy | last post by:
I've converted a VS 2003 project to VS 2005. I have one utility class that it put in the APP_CODE directory. When I try and compile I'm getting this error... Error 1 The type or namespace name...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.