472,328 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 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 1837
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 :...
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...
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...
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...
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...
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...
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...
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...
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...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.