Solved

not all code paths return a value

Posted on 2004-04-08
2
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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