Advertisement

07.29.2008 at 03:46AM PDT, ID: 23603489
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

C# newbie converting from VB inheritance question

Asked by Silas2 in WebApplications, C# Programming Language

Can anyone explain to me if there is a bit more elegant way of doing this in c#:
this is the VB equivalent:
Start Free Trial
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:
Module Module1
 
    Sub Main()
        Dim o As New Customer
        o = UsesCustomer(o)
        Console.Write(o.IAmInAllDescendants)
        Console.Read()
    End Sub
    Public Class BaseObject
        Public IAmInAllDescendants As String
    End Class
    Public Class Customer
        Inherits BaseObject
        Public JustInCustomer As String
    End Class
    Public Sub WrapperFunction(ByRef oToUse As BaseObject)
        oToUse.IAmInAllDescendants = "I've been wrapped"
    End Sub
    Public Function UsesCustomer(ByVal oCustomer As Customer) As Customer
        WrapperFunction(oCustomer)
        Return oCustomer
    End Function
End Module
When I run it through my Instant C# converter it yields this:
using System;
using System.Collections.Generic;
using System.Text;
 
using System;
using System.Collections.Generic;
using System.Text;
 
namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            Customer o = new Customer();
            o = UsesCustomer(o);
            Console.Write(o.IAmInAllDescendants);
            Console.Read();
 
        }
        public class BaseObject
        {
            public string IAmInAllDescendants;
        }
        public class Customer : BaseObject
        {
            public string JustInCustomer;
        }
        public static void WrapperFunction(ref BaseObject oToUse)
        {
            oToUse.IAmInAllDescendants = "I've been wrapped";
        }
   
        public static Customer UsesCustomer(Customer oCustomer)
        {
            WrapperFunction(ref oCustomer);
            return oCustomer;
        }
 
    }
}
//if can only get this to compile if if explicitly upcast
public static Customer UsesCustomer(Customer oCustomer)
        {
            BaseObject x = oCustomer;
            WrapperFunction(ref x);
            oCustomer = (Customer)x;
            return oCustomer;
        }
 
//is there a more elegant way of doing this?
 
Keywords: C# newbie converting from VB inherit…
 
Loading Advertisement...
 
[+][-]07.29.2008 at 04:59AM PDT, ID: 22110527

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 05:22AM PDT, ID: 22110667

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 05:26AM PDT, ID: 22110700

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 05:32AM PDT, ID: 22110752

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 05:46AM PDT, ID: 22110854

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 06:05AM PDT, ID: 22111001

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 06:16AM PDT, ID: 22111083

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 06:41AM PDT, ID: 22111310

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 09:30AM PDT, ID: 22113121

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 11:07AM PDT, ID: 22113957

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 11:25AM PDT, ID: 22114099

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 11:34AM PDT, ID: 22114160

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.30.2008 at 02:11AM PDT, ID: 22118563

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 06:48AM PDT, ID: 22138153

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 06:57AM PDT, ID: 22138244

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: WebApplications, C# Programming Language
Sign Up Now!
Solution Provided By: margajet24
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.01.2008 at 01:06PM PDT, ID: 22141557

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 07:28PM PDT, ID: 22142922

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2008 at 08:30AM PDT, ID: 22161912

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.13.2008 at 11:37AM PDT, ID: 22224347

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628