PC Review


Reply
Thread Tools Rate Thread

Beginner Question. What does the > mean? Not greater than.

 
 
needin4mation@gmail.com
Guest
Posts: n/a
 
      7th Sep 2006
I was looking at this code, and have seen it in other code (like it):

/// <summary>
/// Bitmap font class for XNA
/// </summary>
public class BitmapFont
{
private SpriteBatch m_sb;
private Dictionary<int, BitmapInfo> m_dictBitmapID2BitmapInfo;

and like:

m_dictBitmapID2Texture = new Dictionary<int, Texture2D>(); //what's
the paren mean too?

What does the < > mean? What do I search on to understand what the
angle bracket symbols mean in a context like this? Thank you for any
help.

 
Reply With Quote
 
 
 
 
Truong Hong Thi
Guest
Posts: n/a
 
      7th Sep 2006
It is Generics syntax, a new feature of .NET v2.0.
Check out C# 2.0 documentation.

(E-Mail Removed) wrote:
> I was looking at this code, and have seen it in other code (like it):
>
> /// <summary>
> /// Bitmap font class for XNA
> /// </summary>
> public class BitmapFont
> {
> private SpriteBatch m_sb;
> private Dictionary<int, BitmapInfo> m_dictBitmapID2BitmapInfo;
>
> and like:
>
> m_dictBitmapID2Texture = new Dictionary<int, Texture2D>(); //what's
> the paren mean too?
>
> What does the < > mean? What do I search on to understand what the
> angle bracket symbols mean in a context like this? Thank you for any
> help.


 
Reply With Quote
 
Joanna Carter [TeamB]
Guest
Posts: n/a
 
      7th Sep 2006
<(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed)...

| What does the < > mean? What do I search on to understand what the
| angle bracket symbols mean in a context like this? Thank you for any
| help.

private Dictionary<int, BitmapInfo> m_dictBitmapID2BitmapInfo;

This indicates that a generic Dictionary class is being "bound" to int, as
the key, and BitmapInfo, as the value, types.

Previously, to create a dictionary in .NET1.1, you would have had to use a
Hashtable and cast both the key and value to/from their real types to
System.Object. A generic class allows you to declare a class that can work
with many different types; in situations where the code remains the same,
only the type changes.

This is especially efficient because any operation that casts a value type
like an integer to System.Object also involves a boxing operation. Generic
classes like List<T> allow binding directly to the integer type as in
List<int> to give you a list of integers that is typesafe and that does not
incur any boxing/casting penalty when adding/retrieving items.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Greater than Less than question! Robert Microsoft Excel Programming 2 28th Feb 2009 04:40 AM
Greater Than/Less Than Question (IF statement?) Bill Microsoft Excel Worksheet Functions 2 16th Feb 2008 03:28 PM
Greater, equal to or less than question Mag\(\)\(\) Microsoft Excel Discussion 2 14th Jul 2007 11:37 AM
Greater Than Less Than Question =?Utf-8?B?UGFwZXJiYWNrIFdyaXRlcg==?= Microsoft Excel Worksheet Functions 5 9th Feb 2006 03:50 PM
No Class at ALL!!! beginner/beginner question =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?= Microsoft ASP .NET 7 3rd Feb 2005 02:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:05 AM.