nedcomp hosting homepage

Producten en Diensten
Dedicated servers
Datacenter informatie
Partners, resellers
Helpdesk informatie
Technische docs, tools
Support homepage
ASP componenten
Praktische ASP, ASP.NET
Visual route server
Whois (domein gegevens)
Software documentatie
Whitepapers
Zoeken
Nedcomp / algemeen

Zoeken
 

Copyright © Nedcomp Hosting
Telefoon nr :   +31 184 670111
Fax nummer :   +31 184 631384
E-mailadres :   info@nedcomp.nl
 

C# Programmer's Reference  

& Operator

The & operator can function as either a unary or a binary operator.

& expr
expr1 & expr2

Where:

expr
An expression.
expr1
An expression.
expr2
An expression.

Remarks

The unary & operator returns the address of its operand (requires unsafe context).

Binary & operators are predefined for the integral types and bool. For integral types, & computes the bitwise AND of its operands. For bool operands, & computes the logical AND of its operands; that is, the result is true if and only if both its operands are true.

User-defined types can overload the binary & operator (see operator).

Example

// cs_operator_ampersand.cs
using System;
class Test 
{
   public static void Main() 
   {
      Console.WriteLine(true & false); // logical and
      Console.WriteLine(true & true);  // logical and
      Console.WriteLine("0x{0:x}", 0xf8 & 0x3f);  // bitwise and
   }
}

Output

False
True
0x38

See Also

C# Operators | 7.10 Logical operators | A.2 Pointer types