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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:07:33+00:00 2026-06-09T08:07:33+00:00

I have a property for a vector like this public Vector2 TestVector { get

  • 0

I have a property for a vector like this

    public Vector2 TestVector
    {
        get { return testvector; }

        set
        {
            testvector = value;

        }
    }

the Vector2 has members X and Y.

When I want to set the property.x and property.y to values, it does not work

// this does not work
TestVector.X = 10;

how do I fix this?

edit: I see I am getting answers saying it’s a struct, but really I have a made up class called dVector2, which is a class type not a struct, and I use that. I only put vector2 here for simplicity, but that backfired.

  • 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-09T08:07:34+00:00Added an answer on June 9, 2026 at 8:07 am

    Another solution nobody mentioned is to just make an accessor method for the X and the Y of each vector you have.

    Public float TestVectorX
    {
        get { return TestVector.X; }
        set { TestVector.X = value; }
    }
    
    Public float TestVectorY
    {
        get { return TestVector.Y; }
        set { TestVector.Y = value; }
    }
    

    Adds a little more code but doesn’t have the extra memory of declaring a new vector every time or the lost encapsulation from making it completely public.

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

Sidebar

Related Questions

hi i have property named. public bool ShowLabels{get; set;} and one toolbar menu button
When you have some property that's like: using Algebra; public Algebra.Vector3 Direction { get
I have a property on my World class that looks like this: public Vec2
I have a property of type uint on my entity. Something like: public class
In our Flex application we have an ActionScript3 class containing a property like this:
I have a property in my backing bean that returns html code: public String
I have a class here that is defined like this: struct USERFPOINT { POINTFLOAT
I have declared my two dimensional array like this. But getting an error due
Let's say I have objects which look very roughly like this: class object {
I have a result set in json with city names, and I'd like to

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.