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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:51:33+00:00 2026-06-10T17:51:33+00:00

I have to pass several arguments to a WCF service so I created a

  • 0

I have to pass several arguments to a WCF service so I created a class with the appropriate fields and thought I’d pass an instance of that class to the service. But the service sees that class as different than the one it has.

So I thought of creating that class in the service, but I found that in the calling program

Class1 c = new Class1 ();//of the class in the service
FieldInfo[] f = c.GetType().GetFields();

Returns nothing.

So I tried making an interface, but the service still wants its class from the service.

So how can I pass a custom class instance and still be able to use that class in the caller like any other class?

EDIT:

This is what I’m doing: I created a website (just the simple template) in VWD (-Visual Studio for web). And added a WCF service and a file with

[DataContract]
[Serializable()]
public class Class1
{
    [DataMember]
    public string s = "";
}

EDIT: OK. For some reason the fields are converted to properties.

Thank you all!

  • 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-10T17:51:35+00:00Added an answer on June 10, 2026 at 5:51 pm

    Here is an example of a Datacontract:

        [DataContract]
    public class Person
    {
        [DataMember]
        public int id { get; set; }
    
        [DataMember]
        public string Name{ get; set; }
    }
    

    Then you can initiate it from your WCF client or pass it as an argument in a method or let it return from a method(function).

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

Sidebar

Related Questions

I have a website with several forms that all pass the same set of
We have several reports that do the same formatting operations (e.g. displaying PASS or
I have a C function that takes several arguments of double indirected pointers. something
I have written several PHP web services where I pass in arguments via the
You have to pass the args variable to the anonymous function, but the anonymous
I have a facebook app that requiers authorization, therefore I have to pass a
I have a class (let's name it TheClass ) that is quite often used
I have several variables (hex colors) defined in a database. I need to pass
I was writing some code where I have a class that can accept mixins
I have a Python function which takes several arguments. Some of these arguments could

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.