Click here to Skip to main content
14,667,959 members
Rate this:
Please Sign up or sign in to vote.
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 => ?

Rate this:
Please Sign up or sign in to vote.

Solution 2

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.
   
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 :)
   
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
Rate this:
Please Sign up or sign in to vote.

Solution 4

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[^]
   
Rate this:
Please Sign up or sign in to vote.

Solution 6

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

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

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

Alex

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100