Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6738111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:19:42+00:00 2026-05-26T11:19:42+00:00

I’ve got an uncompiled site using C#. I’ve got 6 files sharing a bunch

  • 0

I’ve got an uncompiled site using C#. I’ve got 6 files sharing a bunch of functions in random classes. I’d like to move these into a more logical separation, but I don’t see how to refer to classes in another cs file.

Ideally, I’d separate these into cs files into logical pieces like shoppingcart class in one file, routine functions in another, etc. And all 6 files can refer to any of the separated cs files.

Is this even possible if we don’t compile them?

update:

Ok, so my code might look like this and the syntax for the ShoppingCart.cart is not correct but it’s an example of how I’d like this to work:

default.aspx.cs:

using ShoppingCart;

public partial class DefaultPage : System.Web.UI.Page
{
  protected void page_load()
  {
    ShoppingCart.cart.CheckCart("newguy");
  }

shoppingcart.cs:

namespace ShoppingCart
{
 public partial class cart : System.Web.UI.Page
  {
    public string CheckCart(string cartname)
    {
      return "test";
    }

etc

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:19:42+00:00Added an answer on May 26, 2026 at 11:19 am

    Is this even possible if we don’t compile them?

    This question doesn’t make sense.

    A code file references another one through a combination of namespace‘s and the using directive.

    Your example kind of shows this. However, it’s completely invalid code (won’t compile) because you don’t have an instance of the cart class to reference. It was never instantiated.

    Which means you need to mark the CheckCart method as static, turn the cart class into a singleton, or make DefaultPage descend from cart.

    Regardless, the ShoppingCart namespace needs to be compiled, which means those 6 files you are talking about need to be grouped into an assembly OR be made part of your main project in order to get the code to run.

    Web Site Projects do some of this completely behind the scenes if you just drop the code into the app_code folder. However, WSP’s do a number of other unexpected things which if you’ve worked with them for any length of time you’ll come to find out are utter garbage.

    So, building on John’s comment, convert it to a Web Application Project. For the additional code you have the option of creating a separate assembly project and throwing it in there or simply leaving it in sub folders of the main project.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.