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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:46:47+00:00 2026-05-28T00:46:47+00:00

I guess with what I’m going to write I should first clarify, it’s not

  • 0

I guess with what I’m going to write I should first clarify, it’s not something I would like to achieve. It is something that happened to me and I am trying understand how it is possible, so I can fix it. So here we go…

I’m using C#, .Net 4.0. The code is biggish, too big to past it all here but I try to explain what happens in hope that there is somebody knowledgeable who will have some thoughts.

In my call stack I have a series of generic methods and I have noticed that although the value should be just passed from one to the other it is changing. Ok, that was my first impression. Later I managed to isolate one problematic method in which when I stop I can see two different values for the same property of an object.

public class Sample : BaseClass, ISomeInterface
{
    [XmlIgnore]
    public new Guid Id { get; set; }
} 

What may be significant that both BaseClass and ISomeINterface define

public Guid Id

so now, when I stop in that generic method and watch variable data of Sample type i can expand its properties and see the first value of Id. But when I watch data.Id it shows different value. Have a look for yourself.

(Here was a picture which I cannot post due to a negligible reputation. Sorry)

Edit: I pushed it there http://picturepush.com/public/7307446

Would any body out there know what is the difference in how those values in the Watch window are obtained? What is the difference? I tried many different approaches, casting, using reflection but always I get the value the same as when you watch data.Id and ironically, the correct value, the one I expect is the other, elusive one.

Oh, and no, it is not a homework 😉

  • 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-28T00:46:48+00:00Added an answer on May 28, 2026 at 12:46 am

    The new keyword is hiding the base class member.

    Set the Id property in BaseClass to virtual:

    public class BaseClass : ISomeInterface
    {
        public virtual Guid Id { get; set; }
    }
    

    And override it in Sample:

    public class Sample : BaseClass, ISomeInterface
    {
        public override Guid Id { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My guess is that this is not possible, but I'd like f and f()
I guess an example of jaas.conf file that uses the NTLoginModule for authentication would
I guess what I am trying to do should be simple, but don’t know
I guess this should be an easy one cause I must be doing something
I guess my question should be silly but it is true that I have
My guess is that class variables (class var) are truly global in storage (that
I guess it should be a common technique, However, I tried the following two
I guess this is covered somewhere but I'm not able to find. Guess I'm
I guess this is easy, I seem to be missing something simple. I need
I guess I'm not clear on how to do and tests. I wanted 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.