?
Solved

returning a struct from a webservice

Posted on 2006-05-31
4
Medium Priority
?
571 Views
Last Modified: 2008-02-20
   struct MyStruct
    {
        public int x;
        public int y;
    };


 [WebMethod]
    public MyStruct getStruct()
    {

        MyStruct ms;
        ms.x = 10;
        ms.y = 20;
        return ms;

    }

Error      1      Inconsistent accessibility: return type 'Service.MyStruct' is less accessible than method 'Service.getStruct()'      d:\WebSite3\App_Code\Service.cs      78      21      d:\WebSite3\

This is the error I am getting

0
Comment
Question by:prgeorge3383
  • 2
4 Comments
 
LVL 5

Expert Comment

by:GENTP
ID: 16799268
have you tried making your struct into a class?
0
 

Author Comment

by:prgeorge3383
ID: 16799284
yes I did

<GenericObjectDataSource DisplayName="Order" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
   <TypeInfo>WindowsApplication1.localhost.Order, Web References.localhost.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

Warning      1      The 'urn:schemas-microsoft-com:xml-msdatasource:GenericObjectDataSource' element is not declared.      C:\Documents and Settings\xxxxT\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Web References\localhost\Order.datasource      8      2      WindowsApplication2


This is the error I am getting with  a class
0
 
LVL 5

Expert Comment

by:GENTP
ID: 16799372
did you update your web reference in your windows application? Just a thought.
0
 
LVL 35

Accepted Solution

by:
mrichmon earned 2000 total points
ID: 16799805
Try adding the word public to the struct definition

public struct MyStruct
    {
        public int x;
        public int y;
    }
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month17 days, 2 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question