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 9141375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:38:11+00:00 2026-06-17T09:38:11+00:00

I hope this is a simple question. I’m building a simple console application in

  • 0

I hope this is a simple question. I’m building a simple console application in C#. I have a class:

using System;
using Filter;

public class Params
{
    public string key;
    public bool distinct;
    public List<string> fields;
    public string filter;
    public int limit;
    public int skip;
    public bool total;
    public List<Tuple<string, GroupType>> group;
    public List<Tuple<string, OrderType>> order;

    public Params()
    {
        key = "";
        distinct = false;
        fields = new List<string>();
        filter = "";
        group = new List<Tuple<string, GroupType>>();
        limit = 0;
        order = new List<Tuple<string, OrderType>>();
        skip = 0;
        total = false;
    }

    public void AddGroup(string field, GroupType type)
    {
        group.Add(new Tuple<string, GroupType>(field, type));
    }

    public void AddOrder(string field, OrderType type)
    {
        order.Add(new Tuple<string, OrderType>(field, type));
    }
}

My program .cs class is:

namespace csharpExample
{
    class Program
    {
        public static void Main(string[] args)
        {
            Params p = new Params();
            Console.WriteLine("Test");
        }
    }
}

I want to use Params in my program.cs class where Main() is called. I thought I could simply use Params like above. I’ve also tried to do a using Params; both of these are errors in VS since it can’t find the directive. I’ve also tried adding my own namespace: namespace MyNameSpace; around my Params class. When I do this I still am unable to do a using MyNameSpace; statement as it can’t find it.

I just want to extract out a bunch of functions into a class that I can reuse. How do i call this class once it’s created?

-Thanks
Thanks for the help.

  • 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-06-17T09:38:12+00:00Added an answer on June 17, 2026 at 9:38 am

    Are you talking about calling the constructor or the properties you are setting? You can set the class at the top of your base class and then call the instance of it. But since it is a static class you should probably use a helper method in the main.

    namespace Example
    {
        public class Program
        {
            Params p = new Params();
    
            string writefromParams()  // I exist just to give the string back from params with a nonstatic method
            {
                return p.key;
            }
    
            static void Main(string[] args)
            {
                Program p2 = new Program();  // set up a new instance of this very class
    
                Console.WriteLine(p2.writefromParams());  // get non static method from class
    
    
                Console.ReadLine();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Very simple question I hope. I have the usual <select> box like this <select
I hope this is a simple question. Can I inherit both an abstract class
i hope this question is not too simple, but i have no idea :(
Simple question I hope. If I have a set of data like this: Classification
I hope this is a simple question. If I have a UINavigationController and I
I hope this will be simple question. I have main activity, on this activity
I hope this is a very simple question (I'm only using bootstrap since today),
I hope this is a simple question, but I have been beating my head
I hope there's a simple solution for this: I have a table where each
I hope this question takes a simple fix, and I am just missing something

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.