What does "Rectangle?" mean?

B

Blau

I am trying to follow some tutorials, and I came across this bit of
code:

public void AddBackground(string backgroundKey, string textureName,
Vector2 position, Rectangle? sourceRect, float scrollRateRatio, Color
color)
{
//the method is then implemented
}

What I don't understand, and what isn't explained in the tutorial, and
what i haven't been able to determine from my reference books, is what
does the "?" after the Rectangle do?

I saw two different opertors listed on msdn, ?: and ?? but the
syntax doesn't seem to be the same as in the tutorial.

Can someone help me out by explaning what "Rectangle?" means?

Thanks

Blau
 
B

Blau

[...]
I saw two different opertors listed on msdn, ?:  and ??   but the
syntax doesn't seem to be the same as in the tutorial.

The ?? operator _might_ have led to you the correct docs, as it's  
related.  But yes, it seems to me that the docs don't provide a very  
direct way for looking this particular question up.

Following a value type name T with ? is a short way of writing  
Nullable<T>.  You can learn more here:http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx

Pete

Thanks Pete for the helpful and quick response! That cleared it right
up for me.

Thanks, Blau
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top