C# How to cast a strong datatype?
<p>I hope some of you guys can help me with this problem....</p>

<p>I have a class library containing amongst other things 1 complex class. this class library is used in 2 other projects in the solution. 1 = Console Application , 2 = Web Service Application (Web Site Application). </p>

<p>In the console application I have created an asmx web service reference, which passes my complex class as the 1 parameter in a method call. </p>

<p>The class is of type : ScheduleSummaryTransport</p>

<p>The function that does the work in the console app is expecting the object bound from the class library DLL, and not from the web service reference. However the web service call is expecting the parameter of type... from the web service reference. </p>

<p>So how can I cast </p>

<p>ClassLibrary.ScheduleSummaryTransport -> WebService.ScheduleSummaryTransport ?</p>

<p>I've tried: </p>

<pre><code>wsReporting.SendReportSummary( (Reporting.ScheduleSummaryTransport) scheduleSummary);
</code></pre>

<p>But in visual studio its detected a design time error : Cannot cast expression.....</p>

<p>Please assist, and thanks</p>

<p><strong>Update</strong></p>

<p>For completeness more code:</p>

<pre><code>/// &lt;summary&gt;
        /// Sends the schedule report via email.
        /// &lt;/summary&gt;
        /// &lt;param name="scheduleSummary"&gt;
        /// The schedule summary.
        /// &lt;/param&gt;
        private static void SendScheduleReport(ScheduleSummaryTransport scheduleSummary)
        {
            if (!Convert.ToBoolean(ConfigurationManager.AppSettings["EmailSummary"]))
            {
                return;
            }

            Trace.WriteLine(string.Empty);
            Trace.WriteLine("Sending summary by email... please wait ");

            Reporting.Reporting wsReporting = new Reporting.Reporting { Timeout = -1 };
            wsReporting.SendReportSummary( (Reporting.ScheduleSummaryTransport) scheduleSummary);
            Trace.WriteLine("Done...");
        }
</code></pre>
