Solved

not all code paths return a value

Posted on 2004-04-08
2
273 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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!
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

821 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