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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:20:26+00:00 2026-05-30T09:20:26+00:00

I want to execute a function but before that , I want to verify

  • 0

I want to execute a function but before that , I want to verify the password.

I choosed to use the Proxy Design Pattern.


in words :

create the Proxy class,

send the password ,

and tell him WHAT FUNCTION TO EXECUTE if password is ok.

the problem is that According to Proxy Pattern the whole internals should/better be private.

so – I cant see from outside the Method1/2…

and i dont want to make Method1/2 public ( and I dont want If’s) . I want to use delegates.

So , how ( from outside) can I send him a valid Action param ? ( the ac param)

Should I crate to each function a public Action ?

enter image description here

  • 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-30T09:20:27+00:00Added an answer on May 30, 2026 at 9:20 am

    Normally the method that you want to execute should not be part of your proxy class. It’s a method that the caller of this class is passing:

    public class ProxyClass
    {
        public ProxyClass(string password, Action ac)
        {
            if (password == "111")
            {
                ac();
            }
        }
    }
    

    and then you could pass an Action as second argument:

    var proxy = new ProxyClass("111", () => 
    {
        ... some code that you want to execute in case of success
    });
    

    or if you already have some method defined:

    public class Foo
    {
        public void Success() 
        {
            ... some code that you want to execute in case of success
        }
    }
    

    you could:

    var foo = new Foo();
    var proxy = new ProxyClass("111", foo.Success);
    

    of if Success was a static method you don’t need an instance of Foo:

    var proxy = new ProxyClass("111", Foo.Success);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to execute a php-script from php that will use different constants and
I want to execute a script every 30mins, but i want to use it
I have a function that I want to execute several times for different DOM
I want to execute a function on all the objects within a List of
In PHP, I want to execute a function when a hyperlink is clicked. The
I want to repeatedly execute a function in Python every 60 seconds forever (just
I want to execute some mysql statements that are stored in a text file
I want to execute this script (view source) that uses Google Translate AJAX API
I have a number of tables that use the Postgres Partitioning feature. I want
My problem is that I want to execute a python file with an argument

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.