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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:26:23+00:00 2026-06-11T11:26:23+00:00

I have a question about coding practice. I want to create a class which

  • 0

I have a question about coding practice. I want to create a class which can’t be initialized. I believe I have 3 options:

  • Abstract modifier
  • Static modifier
  • Private constructor

I don’t want to create a static class simply because of having to name all of my properties and methods ‘static’ – it looks messy (and I can’t use the ‘this’ keyword).

According to the MSDN:

Use the abstract modifier in a class declaration to indicate that a
class is intended only to be a base class of other classes.

Edit Nothing will inherit form this class.

However, it would be a solution (but it seems wrong to me to use it in this situation).

Or, I can make a private constructor so the class cannot be initialized.

If it helps the reason for why is this: The class is responsible for starting off a work flow process. It doesn’t need to be initialized since nothing is returned – it just needs to be ‘started’.

Demo code

class Program
{
    static void Main(string[] args)
    {
        WorkFlow wf = new WorkFlow(); // this will error which is fine!
        ComplexObject co = new ComplexObject();
        WorkFlow.Begin(co);
        Console.ReadKey();
    }
}

public class WorkFlow 
{
    private WorkFlow()
    {
        //private to prevent initialization but this feels wrong! 
    }

    public static void Begin(ComplexObject co)
    {
        //code to begin the workflow
    }
}
  • 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-11T11:26:24+00:00Added an answer on June 11, 2026 at 11:26 am

    What about doing just what you have done but using your Begin method as a factory to create your workflow.

    var workflow = Workflow.Begin(complexObject); 
    
    public class WorkFlow  
    { 
        private WorkFlow() 
        { 
            //private to prevent initialization but this feels wrong!  
        } 
    
        public static WorkFlow Begin(ComplexObject co) 
        { 
            return new Workflow(co);
        } 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about best C++ coding practices. I noticed that for almost
I've got a basic question about obj-c coding, say I have two classes represented
I have a question about CSS coding practices. IE often requires hacks or workarounds
I have a basic question about using the Best Practices in coding. (I'm using
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all
I have question about normalization. Suppose I have an applications dealing with songs. First
I have question about interpreting strings as packed binary data in C++. In python,
i have question about YAJLiOS parser... I have next json data : {{ body

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.