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

  • Home
  • SEARCH
  • 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 5973513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:48:38+00:00 2026-05-22T20:48:38+00:00

I have the following interface: public IStateMachineConfigurator { ??? Configure(StateMachine machine); } In the

  • 0

I have the following interface:

public IStateMachineConfigurator
{
  ??? Configure(StateMachine machine);
}

In the implementation I am calling some of the StateMachine methods to configure it like this:

machine.Configure(States.State1)
       .Allow(Triggers.Trigger1);

The question is, can I rely on the fact that the StateMachine object is a reference or should I use a return value or a return parameter like ref/out?

EDIT:
The state machine itself comes from a library and thus I cannot decide it’s implementation.

  • 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-22T20:48:39+00:00Added an answer on May 22, 2026 at 8:48 pm

    Yes, you can rely on the fact that StateMachine is an object reference. Some people might choose to return a bool or perhaps an enum to give the programmer some kind of hint as to what happened in the Configure method (ie. success/fail/no change/etc.). Others might choose to throw an exception in the event something goes wrong.

    All are perfectly valid, just be careful how deep you chain the method together, as something like:

    machine.Configure().Allow().someMethod().someOtherMethod()

    Gets difficult to debug and trace.

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

Sidebar

Related Questions

I have this following interface : public interface FruitDetails { public String getFruitName(); }
I have the following interface: public interface IPlateSubCategory<T> { T GetItem(int plateID); } And
I have the following interface: public interface SingleRecordInterface<T> { public void insert(T object); }
I have the following interface public interface IHandler<T> { void Handle(T myObject); } I'd
Consider I have the following interface: public interface A { public void b(); }
I have the following method and interface: public object ProcessRules(List<IRule> rules) { foreach(IRule rule
I have defined the following Interface [ServiceContract] public interface IHealthProducts { [OperationContract()] ResponseClass OrderSelfSignedHealthCertificate();
I have the following Interfaces: public interface ITemplateItem { int Id { get; set;
If use MongoRepository, You can have following code: @Repository public interface UserRepo extends MongoRepository<User,
I have the following two interfaces: public interface IMembershipProvider { object Login(ILoginProviderParameters loginParameters); void

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.