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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:13:21+00:00 2026-05-25T22:13:21+00:00

I am learning vb.net and I am having trouble wrapping my head around the

  • 0

I am learning vb.net and I am having trouble wrapping my head around the following…

I can create several properties of a custom class and get/set values or I can create a method to set them all at once. If each property is going to allow read and write should I just make a method to assign values all at once? I assume that I am missing a very important piece here. Example:

I can create 2 properties:

    Public Class Employee
        Public Property LastName as string
        Get 
            Return strLastName
        End get

        Set(ByVal value as string)
            strLastName= value
        End Set
        End Property

        Public Property FirstName as string
        Get 
            Return strFirstName
        End get

        Set(ByVal value as string)
            strFirstName= value
        End Set
        End Property
    End Class

or I can create a method:

    Public Class Employee
        Public Sub AddEmployee(ByVal strLastName, ByVal strFirstName)
            LastName = strLastName
            FirstName = strFirstName
        End Sub
    End Class

I apologize for such a noob question, but any insight is greatly appreciated. thank you!

  • 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-25T22:13:21+00:00Added an answer on May 25, 2026 at 10:13 pm

    If you only have a single method, you will have to use it even if you only want to change the value of a single field.

    Additionally, in such a method, if you need to validate the input, you will need to write quite a lot of code for validation that is not relevant to all of the fields.

    If values must be updated together, use a method to update them together and do not provide setters.

    The reality of things is that how to do this depends on what you are modelling in your class. There are no hard and fast rules that say that properties are better than methods or vice versa.

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

Sidebar

Related Questions

I'm learning asp.net mvc and found something interesting: It seems that I can't explicitly
I'm having a tiny issue with my App_Code folders. I'm learning ASP.NET and, therefore,
I have been learning .MVC recently and am having trouble understanding how to process
I've taken up learning vb.net having come from a C# background. I was trying
I'm just learning ASP.NET MVC and my first project is to create a simple
I'm trying to wrap my head around asp.net. I have a background as a
I am having a 'learning' day and am delving into an ASP.NET solution to
I'm learning ASP.NET MVC Framework, From some articles like this , it seems that
I'm learning ASP.NET MVC and bugged by one issue. In the HomeController, the Index
I'm still learning ASP.NET and I often see code like this throughout parts of

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.