0

Here is info about our technical development environment :

• .NET 6

• C# 10

• Visual Studio 2022

Here is my code:

public class TestEntity
{
    public int TestMethod()
    {
        object? someObject = new
        {
            info_id = "TestItOutInfoId",
            customer_email_address = lin@newyork.com,
            subject = "Resolved",
            sent_date_time = DateTime.Now,
            sender_email_address = mac@don.com
       };

        someObject. Blah blah do Not know what method can access the aforementioned properties listed above. BlahBlah

        return 0;
    }
}

enter image description here

enter image description here

I could Not find anything on the internet that relates to code that will access the content "member variables" within a Nullable instance.

Furthermore, in the picture snapshot above, Visual Studio 2022 Intellisense does Not show any helpful methods that will allow me to access said content "member variables"

Could someone please respond by posting code that will allow me to access them?

crazyTech
  • 1,379
  • 3
  • 32
  • 67
  • 1
    `object?` is a nullable reference type, which has nothing to do with `Nullable<>` (the latter is only applicable to value types). You're creating an anonymous type. Just use `var` instead of `object?`. – Yarik Apr 19 '23 at 20:41
  • I can't change from object? because the variable that is of object? type is part of a 3rd-party software API that I can Not modify. Could you please advise? – crazyTech Apr 19 '23 at 20:49
  • @Yarik Thx. However, this link will lead to the code solution that helped me: https://stackoverflow.com/a/4144815/1338998 – crazyTech Apr 19 '23 at 21:31
  • I don't get how can you not change the variable type. Looking at the code above, you clearly can. – Yarik Apr 19 '23 at 21:35

0 Answers0