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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:05:26+00:00 2026-05-12T22:05:26+00:00

I have a simple .NET application which runs as Windows Service. Say it has

  • 0

I have a simple .NET application which runs as Windows Service.
Say it has one Class

MyClass
{
  Run(Destination d)
  Walk(Destination d)
  Wash(Dishes d)
}

I want to create a console application where I would type simple human readable commands
like

run left
walk right

Pretty much like you do in windows console. I wonder what is the best way to implement this mapping. A straight methods is of course create your own string parser with lots of switch statements but I think if there is better and faster method.

  • 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-12T22:05:27+00:00Added an answer on May 12, 2026 at 10:05 pm

    This might be too much for your needs, but I think a robust, flexible way to do it would be creating a couple of meta-data attributes to decorate the classes you might want to call from your shell, something like:

    [ScriptableClass]
    public class MyClass
    {
         [ScriptableMethod(typeof (Destination),typeof(int))]
         public void Run (Destination f, int distance) {}
    }
    

    Then, during your shell’s startup, you load your assemblies via reflection and look for types marked with the ScriptableClass attribute. For each of them, you inspect their public methods looking for those marked with the ScriptableMethod attribute, and you can build a dictionary of classes and their scriptable methods (along with info about parameters). For the previous example, you would have a ‘MyClass.Run’ command you can could from the shell. When received, your scripting engine would create / lookup an instance of the class and execute the method.

    The advantage of this method is that you wouldn’t have to modify your scripting engine every time you add new classes or modify methods.

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

Sidebar

Related Questions

A simple question. I have an ASP.NET web application which contains several assemblies and
I created a simple ASP.NET MVC version 1.0 application. I have a ProductController which
On Windows 7, VB.NET Express, I have developed a simple Forms application. I don't
I have implemented simple com.sun.net.httpserver.HttpServer application using one of examples in the internet. Server
I have a windows service application that runs as Local System, and I want
I have created a very simple ASP.NET application with a web.config file, which contains
I have a asp.net web application which has a number of versions deployed on
I have a very simple .net application for testing SMTP on .net. But i
We have a very simple ASP.NET web application comprising mostly static content and a
I have a very large ASP.NET application in C#. The issue is simple yet

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.