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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:04:16+00:00 2026-06-04T07:04:16+00:00

I am new to programming so I don’t know what the terminology is and

  • 0

I am new to programming so I don’t know what the terminology is and I apologize. I want to be able to write something that looks like this:

Label Label1 = new Label();
Label1.Text = DateTime.Now.ToString("MM.dd.yyyy");

But with my own objects:

Reciept ReciptForAirPlaneTicket = new Reciept();
ReciptForAirPlaneTicket.MOP = MOP.CreditCard.Visa("4111111111111111|0815");

Reciept ReciptForFood = new Reciept();
ReciptForFood.MOP = MOP.CreditCard.MasterCard("4222222222222222|0917");

Reciept ReciptForClothes = new Reciept();
ReciptForClothes.MOP = MOP.Cash;

Reciept ReciptForTools = new Reciept();
ReciptForTools.MOP = MOP.Check("12345");

I really am not trying to be lazy, but I have been looking for almost a day now and I don’t even know what to look for. I think I need to make at least a class but also a struct or something called enum but I really don’t know.

I am using C#.

  • 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-04T07:04:17+00:00Added an answer on June 4, 2026 at 7:04 am

    It seems like an unusual approach to me, but to get the exact syntax, you could create a kind of factory pattern using a static class MOP.

    public class MethodOfPayment
    {
        public enum enumCardType { Visa, Mastercard };
        public enum enumPaymentType { CreditCard, Cash };
    
        public string Number { get; set; }
        public enumPaymentType PaymentType { get; set; }
        public enumCardType CardType { get; set; }
    }
    
    public static class MOP
    {
        public static class CreditCard
        {
            public static MethodOfPayment Visa(string number)
            {
                return new MethodOfPayment() { 
                    Number = number,
                    PaymentType = MethodOfPayment.enumPaymentType.CreditCard,
                    CardType = MethodOfPayment.enumCardType.Visa
                };
            }
        }
    }
    

    Repeat for the other types, and then instantiate as required.

    ReciptForAirPlaneTicket.MOP = MOP.CreditCard.Visa("4111111111111111|0517"); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to programming for Linux environments, so I don't exactly know what
I'm new to C++ programming and would greatly appreciate replies that don't assume much
I am very new to programming, so I apologize if this question seems absurdly
I'm new to programming and I don't know how to set up a normal
I am a new to programming with Java and I would like to know
I am new to programming and this is my first project so I don't
I am new to programming. I don't understand what's wrong. This code always returns
I'm very new in programming. The following task looks very simple but I don't
I'm new in C++ programming, so please don't be too harsh now :) .
I'm new to C# and don't have any programming experience. But I've finish a

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.