Solved

not all code paths return a value

Posted on 2004-04-08
2
271 Views
Last Modified: 2010-04-15
hi there,

i got that "not all code paths return a value" message when i just created a method like this:

public Category getCategory(string catid)
{
}

since i haven't added any code in it, i don't understand why the complier complained about it.  can anyone give me a hint?

thank you.
0
Comment
Question by:mlcy44
2 Comments
 
LVL 12

Accepted Solution

by:
dfiala13 earned 90 total points
ID: 10785666
Yes,
It expects a variable of the type Category to be returned.  Since you haven't supplied one it gets upset.

You can stub it out this way until you add in your logic...

public Category getCategory(string catid)
{
 return new Category();
}
0
 

Author Comment

by:mlcy44
ID: 10785739
ty, i just realized that.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# Error - Add Failed 12 78
c# string handling 1 26
free scanner TWAIN can be operated with a Web application 9 34
Exit the loop 4 22
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
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!
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 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

8 Experts available now in Live!

Get 1:1 Help Now