Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
what does "- > " operator in C# mean
Posted
Updated 8-May-11 23:50pm
v2
Comments
Groulien 9-May-11 4:56am    
Don't you mean => ?

Steven.Pinto wrote:
what does "-- > " operator in C# mean

Syntax error!
:-)
 
Share this answer
 
Comments
Alexandru Ghiondea 22-Jul-11 12:51pm    
It depends :). You can use it like this:

int a = 10;
while (a --> 10)
{
//...
}

Alex
I think you mean '=>'.
It's used for Lambda expressions
Here's a quote from MSDN:
"A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types."
Might I recommend:
Exploring Lambda Expression in C#[^]
and
Lambda @ MSDN[^]
 
Share this answer
 
That's the dereference operator (->), which works very similar to the same operator in C++. It is used to access member and methods of a class or structure over a pointer. In C# you can use pointers in unsafe code only, so under normal conditions you will not encounter pointers and the need to dereference them too often.
 
Share this answer
 
v2
Comments
ambarishtv 9-May-11 5:01am    
could you please give an example?
[no name] 9-May-11 5:03am    
look here: http://msdn.microsoft.com/de-de/library/s8bz4d5h(v=VS.80).aspx
ambarishtv 9-May-11 5:53am    
my five :)
Sergey Alexandrovich Kryukov 9-May-11 11:12am    
Great, but... Would you find the referenced document in English? :-)
Also, please explain that this is only in unsafe code, and where....
--SA
[no name] 10-May-11 1:32am    
Ooops. That happens when you switch between languages all day. Here you go, all that microsoft has to say about unsafe code with lots of links: http://msdn.microsoft.com/en-us/library/t2yzs44b

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