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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:53:40+00:00 2026-05-25T19:53:40+00:00

I have wrote a class (a snippet is below) which have some data members

  • 0

I have wrote a class (a snippet is below) which have some data members where i put data from the Client Side. I should send this data through Web Services where is a class which includes my data members, but has more data members that my class.

I should cast from my type into another type.

The problem is that i don’t know how to access data members to take data from.

all my data are into this object “OBJ”:

__XtraInvoiceInfo OBJ = new __XtraInvoiceInfo();

and , the Web Services’s type is “InvoiceWithEntriesInfo”

var convertedObj = new InvoiceWithEntriesInfo()
            {
                invoiceNumber = OBJ.BasicInfo.InvoiceNumber --> member is not access.
                                           |  Equals
                    Visual Studio suggests |  GetHashCode
                    only these methods     |  GetType
                                           |  ToString

                invoiceDate = OBJ.BasicInfo.InvoiceDate *--> member is not accessible
                firstName = OBJ.Payer.FirstName *-->> not accessible
                lastName =  OBJ.Payer.LastName *-->> not accessible                      
                catem = OBJ.Payer.Catem *-->> not accessible
            };

error “member is not accessible” means *–> ‘object’ does not contain a definition for ‘InvoiceDate’ and no extension method ‘InvoiceDate’ accepting a first argument of type ‘object’ could be found (are you missing a using directive or an assembly reference?)

 public sealed class __XtraInvoiceInfo
{
    private long _payerType = -1;

    public long PayerType
    {
        get
        {
            return this._payerType;
        }
        set
        {
            this._payerType = value;

            if (value == Constants.NATURAL_PAYER)
            {
                this.Payer = new __NaturalInvoiceInfo();
            }                
        }
    }

    public object Payer
    {
        get; set;
    }

    public object BasicInfo
    {
        get; set;
    }


    //-- Nested Types --
    public sealed class __NaturalInvoiceInfo
    {          
        public string FirstName
        {
            get; set;
        }

        public string LastName
        {
            get; set;
        }

        public long Catem
        {
            get; set;
        }
    }

    public sealed class __BasicInvoiceInfo
    {
        public long InvoiceNumber
        {
            get; set;
        }

        public DateTime? InvoiceDate
        {
            get; set;
        }
    }

}

I made properties Payer and BasicInfo because through them i take data from Client and i made a subbinding into my members like this way:

model.BindModel(xii =>
            {
                var bindModel = new ValidationFrameBindModel<__XtraInvoiceInfo.__BasicInvoiceInfo>();

                this.BindControls(bindModel);

                model.BindModel<__XtraInvoiceInfo.__BasicInvoiceInfo>((x,b) => x.BasicInfo = b, bindModel);
            });

Thank you so much!!! if you have the power to answer my question.
I’m ready to say more details if it is required.

  • 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-25T19:53:40+00:00Added an answer on May 25, 2026 at 7:53 pm

    Well this is the problem:

    public object Payer { get; set; }
    public object BasicInfo { get; set; }
    

    You’re only declaring the properties as being of type object – why not give them more useful types? If you don’t know the types, how do you know what properties will be there? Can you create abstract base class or interface which declares all the properties you want to guarantee will be there? (It’s fairly hard to tell what you’re trying to do, to be honest.)

    If you’re using C# 4 and .NET 4 you could just make them dynamic:

    public dynamic Payer { get; set; }
    public dynamic BasicInfo { get; set; }
    

    Then accessing sub-properties will be bound at execution time against the actual type of object.

    On a side-note, please don’t prefix type names with __ – the C# specification reserves identifiers using __ for compiler-specific features. From section 2.4.2:

    Identifiers containing two consecutive underscore characters (U+005F) are reserved for use by the implementation. For example, an implementation might provide extended keywords that begin with two underscores.

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

Sidebar

Related Questions

I need mock some class with final method using mockito. I have wrote something
I have a Windows Forms application that I wrote that does some monitoring of
Right now I'm getting this exception from a simple JMS client I wrote to
I have a data of Element class. I'm trying to write its values to
Guys, I am very new to c++. I have just wrote this class: class
I have a class I wrote in Java and one of the methods is
i have a input tag which is non editable, but some times i need
For my programming class I have to write a linked list class. One of
I have this Array i wrote a function MostFreq that takes an array of
I wrote this code I have these errors Cannot implicitly convert type x.Program.TreeNode' 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.