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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:04:54+00:00 2026-05-25T11:04:54+00:00

I’m not sure exactly how to phrase this, but here goes: I have a

  • 0

I’m not sure exactly how to phrase this, but here goes:

I have a custom class called EmailAttachment which has 3 properties/attributes defined. An object of this class is passed to a method (in another class, of course) called UploadAttachment

void UploadAttachment(EmailAttachment attachment);

However, when I implement this using, for example,

client.UploadAttachment(emailAttachmentInstance)

Visual Studio tells me that UploadAttachment does not accept 1 argument instead it accepts 3 (ie the variables from the class definition).
This has me quite confused so any help is appreciated


To clarify a bit…

client is actually an instance of a WCF service. The service interface includes

[OperationContract]
void UploadAttachment(EmailAttachment attachment); //which is public.    

Following is the class in question…

[MessageContract]
public class EmailAttachment
{
    [MessageHeader(MustUnderstand = true)]
    public int EmailID;

    [MessageHeader(MustUnderstand = true)]
    public string FileName;

    [MessageBodyMember(Order = 1)]
    public Stream AttachmentFile;
}
  • 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-25T11:04:55+00:00Added an answer on May 25, 2026 at 11:04 am

    So here’s my answer (partially conjecture/hypothesis of a friend)…
    I guess it has to do with the nature of the WCF service. In order to prevent complications client-side (i.e. being dependent on class(es) defined by the service), the client can pass the attributes/properties (the 3 mentioned previously) of the [service] class as the arguments of the method (in this case UploadAttachment()). Therefore, it only needs to know the data types of those attributes/properties, and does not have to instantiate an object of its class. The same can be done for custom return types.
    For example, if SomeClass is defined as such…

    [MessageContract]
    public class SomeClass
    {
        [MessageBodyMember]
        public bool value;
    
        public SomeClass(bool value)
        {
            this.value = value;
        }
    }
    

    …and the service has a method that returns a value of SomeClass like so…

    SomeClass SomeMethod();
    

    …the client can call SomeMethod() like so…

    bool someReturnValue = client.SomeMethod();
    

    instead of having to instantiate SomeClass.

    Hopefully that makes sense.

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

Sidebar

Related Questions

This could be a duplicate question, but I have no idea what search terms
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have an autohotkey script which looks up a word in a bilingual dictionary
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an array which has BIG numbers and small numbers in it. I

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.