class convertion compilation error

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default class convertion compilation error

    I have a ClassLibrary(ClassLibrary1) with 2 classes (MyClass1, MyClass2).
    (one inherits a DataSet, and the other requires a DataSet in its
    constructor).

    My Winform project and Asp.Net Web service both reference my
    ClassLibrary1.dll.

    My webservice has 2 methods (one returns MyClass1, the other MyClass2).

    I keep getting compilation error -

    Cannot implicitly convert Cannot implicitly convert type
    'TestBed.localhost.MyClass1' to 'ClassLibrary1.MyClass1'

    for this line of code -

    MyClass1 mc = ws.GetMyClass1(); //ws = webservice

    Any Help appreciated.


    hs Guest

  2. Similar Questions and Discussions

    1. error message: Microsoft JScript compilation error '800a03ec'
      Recieved following error message: Microsoft JScript compilation error '800a03ec' Expected ';' ...
    2. #25580 [WFx]: set_error_handler to a class/method resets class properties when error occurs
      ID: 25580 Updated by: sniper@php.net Reported By: paul dot liversidge at recycledpixels dot com Status: Wont...
    3. #25580 [Opn]: set_error_handler to a class/method resets class properties when error occurs
      ID: 25580 User updated by: paul.liversidge@recycledpixels.com Reported By: paul dot liversidge at recycledpixels dot com...
    4. #25580 [NEW]: set_error_handler to a class/method resets class properties when error occurs
      From: paul dot liversidge at recycledpixels dot com Operating system: Windows XP PHP version: 4.3.2 PHP Bug Type: ...
    5. Server Error in '/' Application - Compilation Error - Temporary ASP.NET Files
      I have a site that works fine on my local box. I then copy it to my production server (Win2003) and when I try to access the site I get: Server...
  3. #2

    Default Re: class convertion compilation error

    Found the answer. (not sure why though)
    I was doing -

    TestBed.localhost.Service1 ws = new TestBed.localhost.Service1();
    MyClass1 mc = ws.GetMyClass1();

    should be -
    TestBed.localhost.Service1 ws = new TestBed.localhost.Service1();
    TestBed.localhost.MyClass1 mc = ws.GetMyClass1();




    "hs" <hs@nospam.syn> wrote in message
    news:%23fi8otcUDHA.1004@TK2MSFTNGP12.phx.gbl...
    > I have a ClassLibrary(ClassLibrary1) with 2 classes (MyClass1, MyClass2).
    > (one inherits a DataSet, and the other requires a DataSet in its
    > constructor).
    >
    > My Winform project and Asp.Net Web service both reference my
    > ClassLibrary1.dll.
    >
    > My webservice has 2 methods (one returns MyClass1, the other MyClass2).
    >
    > I keep getting compilation error -
    >
    > Cannot implicitly convert Cannot implicitly convert type
    > 'TestBed.localhost.MyClass1' to 'ClassLibrary1.MyClass1'
    >
    > for this line of code -
    >
    > MyClass1 mc = ws.GetMyClass1(); //ws = webservice
    >
    > Any Help appreciated.
    >
    >

    hs Guest

  4. #3

    Default Re: class convertion compilation error

    Hello,

    The error message showed the reason. :-)

    After adding reference the web service, the return type of ws.GetMyClass1()
    is TestBed.localhost.MyClass1. It is not ClassLibrary1.MyClass1. Yes, we
    know that the two classes are the same. However, for the compiler, it has
    no knowledge of it. What it knows is that these two classes have the same
    name but belong to different namespaces. So it feels that they are
    different classes. That is why you got that error message.

    Did this answer your question?

    Regards,

    HuangTM
    Microsoft Online Partner Support
    MCSE/MCSD

    Get Secure! ¨C [url]www.microsoft.com/security[/url]
    This posting is provided ¡°as is¡± with no warranties and confers no rights.


    Tian Min Huang Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139