Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 131,722 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,290 people online right now. Registration is fast and FREE... Join Now!




Console in C#

 
Reply to this topicStart new topic

Console in C#, need help with the return type

Taccora
post 5 Oct, 2008 - 08:11 AM
Post #1


New D.I.C Head

*
Joined: 5 Oct, 2008
Posts: 8

Deleted, my question was answered.

This post has been edited by Taccora: 5 Oct, 2008 - 08:27 AM
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 5 Oct, 2008 - 08:15 AM
Post #2


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,909



Thanked 116 times

Dream Kudos: 8450

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


If this is what you're ferring to

csharp

public Order( decimal initialBalance )
{
Balance = initialBalance; //initial order balance
}


Well you're getting that message because, I believe this is your class constructor, your class is named Orders and here you have Order, meaning the compiler is expecting something that returns a type order, which ould be something like

csharp

public Order GetNewOrder( decimal initialBalance )
{
Balance = initialBalance; //initial order balance
}


Notice it returns an Order type but is named GetNewOrder. So change it to this and your error should go away

csharp

public Orders( decimal initialBalance )
{
Balance = initialBalance; //initial order balance
}
User is offlineProfile CardPM

Go to the top of the page

jacobjordan
post 5 Oct, 2008 - 08:16 AM
Post #3


class Me : Perfection

Group Icon
Joined: 11 Jun, 2008
Posts: 1,103



Thanked 22 times

Dream Kudos: 1525
My Contributions


If you don't want a method to return anything, you have to specify a return type of void. So it would look like
csharp

public void Order( decimal initialBalance )
{
Balance = initialBalance; //initial order balance
}

However, If that is supposed to be your constructor, like you said, then all you have to do is change it's name to the name of the class.

This post has been edited by jacobjordan: 5 Oct, 2008 - 08:18 AM
User is offlineProfile CardPM

Go to the top of the page

Taccora
post 5 Oct, 2008 - 08:24 AM
Post #4


New D.I.C Head

*
Joined: 5 Oct, 2008
Posts: 8

thank you SO much. That was bugging me the last 48 hours. I just couldn't, for the life of me, figure out why that was happening.

QUOTE(jacobjordan @ 5 Oct, 2008 - 09:16 AM) *

If you don't want a method to return anything, you have to specify a return type of void. So it would look like
csharp

public void Order( decimal initialBalance )
{
Balance = initialBalance; //initial order balance
}

However, If that is supposed to be your constructor, like you said, then all you have to do is change it's name to the name of the class.



Thanks for your response. The two of you have been so helpful
User is offlineProfile CardPM

Go to the top of the page

Jayman
post 5 Oct, 2008 - 08:42 AM
Post #5


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,827



Thanked 38 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


In the future, do not delete the content of your posts just because your question was answered/solved.

This removes any benefit to other members who may be seeking a solution to the same problem.
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 10:07AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month