If you're using C# 2.0 you could use nullable types and return a 'layout?'
type (lookup nullable types and System.Nullable in the documentation)
If not, you can't have such a thing as a null struct. You would have to do
something like return an object type instead and have the caller unbox, have
a special return struct value meaning "null" or return as a ref param and
have an error code as the return of the function.
"Digital Fart" <pr*********@angelfire.com> wrote in message
news:0t********************************@4ax.com...
I have the following function that returns a struct
public struct layout
{
public string str;
public int i;
}
function in some class where i loop through an arraylist of structs
public layout getLayout(string s)
{
foreach ( layout l in layoutArray)
if ( l.str == s ) return l;
}
but this does not compile because when i can't find l.str == s
what should i return then?