Click here to Skip to main content
15,909,445 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi everybody,
There are somethings in code i do not know what they mean

First: in this code
XML
public static Nullable<T> DbValueToNullable<T>(object dbValue) where T : struct
        {
            Nullable<T> returnValue = null;

            if ((dbValue != null) && (dbValue != DBNull.Value))
            {
                returnValue = (T)dbValue;
            }

            return returnValue;
        }

What is the meaning of: where T : struct?

Second:
decimal? averagePriceInRange;
What is the meaning of: ( ? ) Question mark?

Thanks
Posted
Updated 10-Jun-10 22:12pm
v2

1 solution

MrProgrammer_78 wrote:
where T : struct

You would want to look into generics for an explanation to this.
This basically means we are constraining the parameter to be a struct.
For more information, see here.


MrProgrammer_78 wrote:
What is the meaning of: ( ? ) Question mark

This is a nullable type. This indicates the averagePriceInRange value can be either a decimal or null.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900