returning a struct from a webservice

Posted on 2006-05-31
Last Modified: 2008-02-20
   struct MyStruct
        public int x;
        public int y;

    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

Question by:prgeorge3383
    LVL 5

    Expert Comment

    have you tried making your struct into a class?

    Author Comment

    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=, Culture=neutral, PublicKeyToken=null</TypeInfo>

    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
    LVL 5

    Expert Comment

    did you update your web reference in your windows application? Just a thought.
    LVL 35

    Accepted Solution

    Try adding the word public to the struct definition

    public struct MyStruct
            public int x;
            public int y;

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now