{"id":22278,"date":"2013-05-13T11:32:14","date_gmt":"2013-05-13T06:02:14","guid":{"rendered":"http:\/\/vskills.in\/certification\/tutorial\/?p=22278"},"modified":"2024-04-12T14:16:46","modified_gmt":"2024-04-12T08:46:46","slug":"operators-and-expressions-of-c-sharp","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/","title":{"rendered":"Operators and expressions"},"content":{"rendered":"<h4><strong>Operators and expressions<\/strong><\/h4>\n<h2>Operators<\/h2>\n<p>C# provides a large set of operators, which are symbols that specify which operations to perform in an expression. Operations on integral types such as <strong>==<\/strong>, <strong>!=<\/strong>, <strong>&lt;<\/strong>, <strong>&gt;<\/strong>, <strong>&lt;=<\/strong>, <strong>&gt;=<\/strong>, <strong>binary +<\/strong>, <strong>binary &#8211;<\/strong>, <strong>^<\/strong>, <strong>&amp;<\/strong>, <strong>|<\/strong>, <strong>~<\/strong>, <strong>++<\/strong>, <strong>&#8212;<\/strong>, and <strong>sizeof()<\/strong> are generally allowed on enumerations. In addition, many operators can be <a>overloaded<\/a> by the user, thus changing their meaning when applied to a user-defined type.<\/p>\n<p>The following table lists the C# operators grouped in order of precedence. Operators within each group have equal precedence.<\/p>\n<div><\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<th>Operator category<\/th>\n<th>Operators<\/th>\n<\/tr>\n<tr>\n<td>Primary<\/td>\n<td><a>x.y<\/a><a>f(x)<\/a><a>a[x]<\/a><a>x++<\/a><a>x&#8211;<\/a><\/p>\n<p><a>new<\/a><\/p>\n<p><a>typeof<\/a><\/p>\n<p><a>checked<\/a><\/p>\n<p><a>unchecked<\/a><\/p>\n<p><a>-&gt;<\/a><\/td>\n<\/tr>\n<tr>\n<td>Unary<\/td>\n<td><a>+<\/a><a>&#8211;<\/a><a>!<\/a><a>~<\/a><a>++x<\/a><\/p>\n<p><a>&#8211;x<\/a><\/p>\n<p><a>(T)x<\/a><\/p>\n<p><a>true<\/a><\/p>\n<p><a>false<\/a><\/p>\n<p><a>&amp;<\/a><\/p>\n<p><a>sizeof<\/a><\/td>\n<\/tr>\n<tr>\n<td>Multiplicative<\/td>\n<td><a>*<\/a><a>\/<\/a><a>%<\/a><\/td>\n<\/tr>\n<tr>\n<td>Additive<\/td>\n<td><a>+<\/a><a>&#8211;<\/a><\/td>\n<\/tr>\n<tr>\n<td>Shift<\/td>\n<td><a>&lt;&lt;<\/a><a>&gt;&gt;<\/a><\/td>\n<\/tr>\n<tr>\n<td>Relational and type testing<\/td>\n<td><a>&lt;<\/a><a>&gt;<\/a><a>&lt;=<\/a><a>&gt;=<\/a><a>is<\/a><\/p>\n<p><a>as<\/a><\/td>\n<\/tr>\n<tr>\n<td>Equality<\/td>\n<td><a>==<\/a><a>!=<\/a><\/td>\n<\/tr>\n<tr>\n<td>Logical AND<\/td>\n<td><a>&amp;<\/a><\/td>\n<\/tr>\n<tr>\n<td>Logical XOR<\/td>\n<td><a>^<\/a><\/td>\n<\/tr>\n<tr>\n<td>Logical OR<\/td>\n<td><a>|<\/a><\/td>\n<\/tr>\n<tr>\n<td>Conditional AND<\/td>\n<td><a>&amp;&amp;<\/a><\/td>\n<\/tr>\n<tr>\n<td>Conditional OR<\/td>\n<td><a>||<\/a><\/td>\n<\/tr>\n<tr>\n<td>Conditional<\/td>\n<td><a>?:<\/a><\/td>\n<\/tr>\n<tr>\n<td>Assignment<\/td>\n<td><a>=<\/a><a>+=<\/a><a>-=<\/a><a>*=<\/a><a>\/=<\/a><\/p>\n<p><a>%=<\/a><\/p>\n<p><a>&amp;=<\/a><\/p>\n<p><a>|=<\/a><\/p>\n<p><a>^=<\/a><\/p>\n<p><a>&lt;&lt;=<\/a><\/p>\n<p><a>&gt;&gt;=<\/a><\/p>\n<p><a>??<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<div>\n<div>\n<p><a title=\"Collapse\">Arithmetic Overflow<\/a><\/p>\n<div>\n<hr \/>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<p>The arithmetic operators (<a>+<\/a>, <a>&#8211;<\/a>, <a>*<\/a>, <a>\/<\/a>) can produce results that are outside the range of possible values for the numeric type involved. You should refer to the section on a particular operator for details, but in general:<\/p>\n<ul>\n<li>Integer arithmetic overflow either throws an <a>OverflowException<\/a> or discards the most significant bits of the result. Integer division by zero always throws a <strong>DivideByZeroException<\/strong>.<\/li>\n<li>Floating-point arithmetic overflow or division by zero never throws an exception, because floating-point types are based on IEEE 754 and so have provisions for representing infinity and NaN (Not a Number).<\/li>\n<li><a>Decimal<\/a> arithmetic overflow always throws an <strong>OverflowException<\/strong>. Decimal division by zero always throws a <a>DivideByZeroException<\/a>.<\/li>\n<\/ul>\n<p>When integer overflow occurs, what happens depends on the execution context, which can be <a>checked or unchecked<\/a>. In a checked context, an <strong>OverflowException<\/strong> is thrown. In an unchecked context, the most significant bits of the result are discarded and execution continues. Thus, C# gives you the choice of handling or ignoring overflow.<\/p>\n<p>In addition to the arithmetic operators, integral-type to integral-type casts can cause overflow, for example, casting a <a>long<\/a> to an <a>int<\/a>, and are subject to checked or unchecked execution. However, bitwise operators and shift operators never cause overflow.<\/p>\n<\/div>\n<\/div>\n<p>In C#, an operator is a term or a symbol that takes one or more expressions, called operands, as input and returns a value. Operators that take one operand, such as the increment operator (<strong>++<\/strong>) or <strong>new<\/strong>, are called unary operators. Operators that take two operands, such as arithmetic operators (<strong>+<\/strong>,<strong>&#8211;<\/strong>,<strong>*<\/strong>,<strong>\/<\/strong>) are called binary operators. One operator, the conditional operator (<strong>?:<\/strong>), takes three operands and is the sole tertiary operator in C#.<\/p>\n<p>The following C# statement contains a single unary operator, and a single operand. The increment operator, <strong>++<\/strong>, modifies the value of the operand <code>y<\/code>.:<\/p>\n<div>\n<div>\n<div dir=\"ltr\">\n<div style=\"color: black;\">\n<pre>y++;<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>The following C# statement contains two binary operators, each with two operands. The assignment operator, <strong>=<\/strong>, has the integer <code>y<\/code>, and the expression <code>2 + 3<\/code> as operands. The expression <code>2 + 3<\/code> itself contains the addition operator, and uses the integer values <code>2<\/code> and <code>3<\/code> as operands:<\/p>\n<div>\n<div>\n<div dir=\"ltr\">\n<div style=\"color: black;\">\n<pre>y = 2 + 3;<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>An operand can be a valid expression of any size, composed of any number of other operations.<\/p>\n<p>Operators in an expression are evaluated in a specific order known as operator precedence. The following table divides the operators into categories based on the type of operation they perform. The categories are listed in order of precedence.<\/p>\n<div><\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td>Primary<\/td>\n<td>x.y, f(x), a[x], x<strong>++<\/strong>, x<strong>&#8212;<\/strong>, <strong>new<\/strong>, <strong>typeof<\/strong>, <strong>checked<\/strong>, <strong>unchecked<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Unary<\/td>\n<td><strong>+<\/strong>, <strong>&#8211;<\/strong>, <strong>!<\/strong>, <strong>~<\/strong>, <strong>++x<\/strong>, <strong>&#8211;x<\/strong>, (T)x<\/td>\n<\/tr>\n<tr>\n<td>Arithmetic \u2014 Multiplicative<\/td>\n<td><strong>*<\/strong>, <strong>\/<\/strong>, <strong>%<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Arithmetic \u2014 Additive<\/td>\n<td><strong>+<\/strong>, <strong>&#8211;<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Shift<\/td>\n<td><strong>&lt;&lt;<\/strong>, <strong>&gt;&gt;<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Relational and type testing<\/td>\n<td><strong>&lt;<\/strong>, <strong>&gt;<\/strong>, <strong>&lt;=<\/strong>, <strong>&gt;=<\/strong>, <strong>is<\/strong>, <strong>as<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Equality<\/td>\n<td><strong>==<\/strong>, <strong>!=<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Logical, in order of precedence<\/td>\n<td><strong>&amp;<\/strong>, <strong>^<\/strong>, <strong>|<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Conditional, in order of precedence<\/td>\n<td><strong>&amp;&amp;<\/strong>, <strong>||<\/strong>, <strong>?:<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Assignment<\/td>\n<td><strong>=<\/strong>, <strong>+=<\/strong>, <strong>-=<\/strong>, <strong>*=<\/strong>, <strong>\/=<\/strong>, <strong>%=<\/strong>, <strong>&amp;=<\/strong>, <strong>|=<\/strong>, <strong>^=<\/strong>, <strong>&lt;&lt;=<\/strong>, <strong>&gt;&gt;=<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>When two operators with the same precedence are present in an expression, they are evaluated based on associativity. Left-associative operators are evaluated in order from left to right. For example, <code>x * y \/ z<\/code> is evaluated as <code>(x * y) \/ z<\/code>. Right-associative operators are evaluated in order from right to left. The assignment operators and the tertiary operator (<strong>?:<\/strong>) are right-associative. All other binary operators are left-associative. However, C# standard does not specify when, in an expression, the &#8220;set&#8221; portion of an increment instruction is executed. For example, the output of the following example code is 6:<\/p>\n<div>\n<div>\n<div dir=\"ltr\">\n<div style=\"color: black;\">\n<pre><span style=\"color: blue;\">int<\/span> num1 = 5;\nnum1++;\nSystem.Console.WriteLine(num1);<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>However, the output of the following example code is undefined:<\/p>\n<div>\n<div>\n<div dir=\"ltr\">\n<div style=\"color: black;\">\n<pre><span style=\"color: blue;\">int<\/span> num2 = 5;\nnum2 = num2++;  <span style=\"color: green;\">\/\/not recommended<\/span>\nSystem.Console.WriteLine(num2);<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Therefore, the latter example is not recommended. Parentheses can be used to surround an expression and force that expression to be evaluated before any others. For example, <code>2 + 3 * 2<\/code> would normally become 8. This is because multiplicative operators take precedence over additive operators. Writing the expression as <code>(2 + 3 ) * 2<\/code> results in 10, because it indicates to the C# compiler that the addition operator (<strong>+<\/strong>) must be evaluated before the multiplication operator (<strong>*<\/strong>).<\/p>\n<p>The following table shows a set of operators used in the C# language.<\/p>\n<table>\n<tbody>\n<tr>\n<th>Category<\/th>\n<th>Symbol<\/th>\n<\/tr>\n<tr>\n<td>Sign operators<\/td>\n<td><code>+ -<\/code><\/td>\n<\/tr>\n<tr>\n<td>Arithmetic<\/td>\n<td><code>+ - * \/ %<\/code><\/td>\n<\/tr>\n<tr>\n<td>Logical (boolean and bitwise)<\/td>\n<td><code>&amp; | ^ ! ~ &amp;&amp; || true false<\/code><\/td>\n<\/tr>\n<tr>\n<td>String concatenation<\/td>\n<td><code>+<\/code><\/td>\n<\/tr>\n<tr>\n<td>Increment, decrement<\/td>\n<td><code>++ --<\/code><\/td>\n<\/tr>\n<tr>\n<td>Shift<\/td>\n<td><code>&lt;&lt; &gt;&gt;<\/code><\/td>\n<\/tr>\n<tr>\n<td>Relational<\/td>\n<td><code>== != &lt; &gt; &lt;= &gt;=<\/code><\/td>\n<\/tr>\n<tr>\n<td>Assignment<\/td>\n<td><code>= += -= *= \/= %= &amp;= |= ^= &lt;&lt;= &gt;&gt;= <\/code><\/td>\n<\/tr>\n<tr>\n<td>Member access<\/td>\n<td><code>.<\/code><\/td>\n<\/tr>\n<tr>\n<td>Indexing<\/td>\n<td><code>[]<\/code><\/td>\n<\/tr>\n<tr>\n<td>Cast<\/td>\n<td><code>()<\/code><\/td>\n<\/tr>\n<tr>\n<td>Ternary<\/td>\n<td><code>?:<\/code><\/td>\n<\/tr>\n<tr>\n<td>Delegate concatenation and removal<\/td>\n<td><code>+ -<\/code><\/td>\n<\/tr>\n<tr>\n<td>Object creation<\/td>\n<td><code>new<\/code><\/td>\n<\/tr>\n<tr>\n<td>Type information<\/td>\n<td><code>as is sizeof typeof <\/code><\/td>\n<\/tr>\n<tr>\n<td>Overflow exception control<\/td>\n<td><code>checked unchecked<\/code><\/td>\n<\/tr>\n<tr>\n<td>Indirection and address<\/td>\n<td><code>* -&gt; [] &amp;<\/code><\/td>\n<\/tr>\n<tr>\n<td>Lambda<\/td>\n<td><code>=&gt;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>An operator usually has one or two operands. Those operators that work<br \/>\nwith only one operand are called <b>unary operators<\/b>.<br \/>\nThose who work with two operands are called <b>binary operators<\/b>.<br \/>\nThere is also one ternary operator (?:), which works with three operands.<\/p>\n<p>Certain operators may be used in different contexts. For example the + operator.<br \/>\nFrom the above table we can see, that it is used in different cases.<br \/>\nIt adds numbers, concatenates strings or delegates; indicates the sign<br \/>\nof a number. We say, that the operator is <b>overloaded<\/b>.<\/p>\n<h2>Sign operators<\/h2>\n<p>There are two sign operators. + and -. They are used to indicate or<br \/>\nchange the sign of a value.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        Console.WriteLine(2);\n        Console.WriteLine(+2);\n        Console.WriteLine(-2);\n    }\n}<\/pre>\n<p>+ and &#8211; signs indicate the sign of a value. The plus sign can be used<br \/>\nto indicate that we have a positive number. It can be omitted and it<br \/>\nis mostly done so.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        int a = 1;\n        Console.WriteLine(-a);    \/\/ prints -1\n        Console.WriteLine(-(-a)); \/\/ prints 1\n    }\n}<\/pre>\n<p>The minus sign changes the sign of a value.<\/p>\n<h2>The assignment operator<\/h2>\n<p>The assignment operator <b>=<\/b> assigns a value to a variable. A <b>variable<\/b><br \/>\nis a placeholder for a value. In mathematics, the <b>=<\/b> operator has a different<br \/>\nmeaning. In an equation, the <b>=<\/b> operator is an equality operator. The left<br \/>\nside of the equation is equal to the right one.<\/p>\n<pre>int x = 1;\nConsole.WriteLine(x); \/\/ prints 1<\/pre>\n<p>Here we assign a number to the x variable.<\/p>\n<pre>x = x + 1;\nConsole.WriteLine(x);<\/pre>\n<p>The previous expression does not make sense in mathematics. But it is legal in programming.<br \/>\nThe expression adds 1 to the x variable. The right side is equal to 2 and 2 is assigned to x.<\/p>\n<pre>3 = x;<\/pre>\n<p>This code example results in syntax error. We cannot assign a value to a literal.<\/p>\n<h2>Concatenating strings<\/h2>\n<p>In C# the + operator is also used to concatenate strings.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        Console.WriteLine(\"Return \" + \"of \" + \"the king.\");\n    }\n}<\/pre>\n<p>We join three strings together using string concatenation operator.<\/p>\n<pre>$ .\/catstrings.exe \nReturn of the king.<\/pre>\n<p>And this is, what we get.<\/p>\n<h2>Increment, decrement operators<\/h2>\n<p>Incrementing or decrementing a value by one is a common task in<br \/>\nprogramming. C# has two convenient operators for this. ++ and &#8211;.<\/p>\n<pre>x++;\nx = x + 1;\n...\ny--;\ny = y - 1;<\/pre>\n<p>The above two pairs of expressions do the same.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        int x = 6;\n\n        x++;\n        x++;\n\n        Console.WriteLine(x);\n\n        x--;\n        Console.WriteLine(x);\n    }\n}<\/pre>\n<p>In the above example, we demonstrate the usage of both<br \/>\noperators.<\/p>\n<pre>int x = 6;\n\nx++;\nx++;<\/pre>\n<p>We initiate the x variable to 6. Then we increment the<br \/>\nx two times. Now the variable equals to 8.<\/p>\n<pre>x--;<\/pre>\n<p>We use the decrement operator. Now the variable equals to<br \/>\n7.<\/p>\n<pre>$ .\/incdec.exe \n8\n7<\/pre>\n<p>And here is the output of the example.<\/p>\n<h2>Arithmetic operators<\/h2>\n<p>The following is a table of arithmetic operators in C#.<\/p>\n<table>\n<tbody>\n<tr>\n<th>Symbol<\/th>\n<th>Name<\/th>\n<\/tr>\n<tr>\n<td>+<\/td>\n<td>Addition<\/td>\n<\/tr>\n<tr>\n<td>&#8211;<\/td>\n<td>Subtraction<\/td>\n<\/tr>\n<tr>\n<td>*<\/td>\n<td>Multiplication<\/td>\n<\/tr>\n<tr>\n<td>\/<\/td>\n<td>Division<\/td>\n<\/tr>\n<tr>\n<td>%<\/td>\n<td>Remainder<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The following example shows arithmetic operations.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        int a = 10;\n        int b = 11;\n        int c = 12;\n\n        int add = a + b + c;\n        int sb = c - a;\n        int mult = a * b;\n        int div = c \/ 3;\n        int rem = c % a;\n\n        Console.WriteLine(add);\n        Console.WriteLine(sb);\n        Console.WriteLine(mult);\n        Console.WriteLine(div);\n        Console.WriteLine(rem);\n    }\n}<\/pre>\n<p>In the preceding example, we use addition, subtraction, multiplication,<br \/>\ndivision and remainder operations. This is all familiar from the mathematics.<\/p>\n<pre>int rem = c % a;<\/pre>\n<p>The % operator is called the remainder or the modulo operator. It finds the<br \/>\nremainder of division of one number by another. For example, 9 % 4, 9 modulo 4 is 1,<br \/>\nbecause 4 goes into 9 twice with a remainder of 1.<\/p>\n<pre>$ .\/arithmetic.exe \n33\n2\n110\n4\n2<\/pre>\n<p>Output of the example.<\/p>\n<hr \/>\n<p>Next we will show the distinction between integer and floating<br \/>\npoint division.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        int c = 5 \/ 2;\n        Console.WriteLine(c);\n\n        double d = 5 \/ 2.0;\n        Console.WriteLine(d);\n    }\n}<\/pre>\n<p>In the preceding example, we divide two numbers.<\/p>\n<pre>int c = 5 \/ 2;\nConsole.WriteLine(c);<\/pre>\n<p>In this code, we have done integer division. The returned value<br \/>\nof the division operation is an integer. When we divide two integers<br \/>\nthe result is an integer.<\/p>\n<pre>double d = 5 \/ 2.0;\nConsole.WriteLine(d);<\/pre>\n<p>If one of the values is a double or a float, we perform a<br \/>\nfloating point division. In our case, the second operand<br \/>\nis a double so the result is a double.<\/p>\n<pre>$ .\/division.exe \n2\n2.5<\/pre>\n<p>Result of the division.exe program.<\/p>\n<h2>Boolean operators<\/h2>\n<p>In C#, we have the following logical operators.<br \/>\nBoolean operators are also called logical.<\/p>\n<table>\n<tbody>\n<tr>\n<th>Symbol<\/th>\n<th>Name<\/th>\n<\/tr>\n<tr>\n<td>&amp;&amp;<\/td>\n<td>logical and<\/td>\n<\/tr>\n<tr>\n<td>||<\/td>\n<td>logical or<\/td>\n<\/tr>\n<tr>\n<td>!<\/td>\n<td>negation<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        int x = 3;\n        int y = 8;\n\n        Console.WriteLine(x == y); \n        Console.WriteLine(y &gt; x);\n\n        if (y &gt; x)\n        {\n            Console.WriteLine(\"y is greater than x\");\n        }\n    }\n}<\/pre>\n<p>Many expressions result in a boolean value. Boolean values are used<br \/>\nin conditional statements.<\/p>\n<pre>Console.WriteLine(x == y); \nConsole.WriteLine(y &gt; x);<\/pre>\n<p>Relational operators always result in a boolean value. These two lines<br \/>\nprint false and true.<\/p>\n<pre>if (y &gt; x)\n{\n    Console.WriteLine(\"y is greater than x\");\n}<\/pre>\n<p>The body of the <code>if<\/code> statement is executed only if the condition<br \/>\ninside the parentheses is met. The y &gt; x returns true, so the message<br \/>\n&#8220;y is greater than x&#8221; is printed to the terminal.<\/p>\n<hr \/>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        bool a = true &amp;&amp; true;\n        bool b = true &amp;&amp; false;\n        bool c = false &amp;&amp; true;\n        bool d = false &amp;&amp; false;\n\n        Console.WriteLine(a);\n        Console.WriteLine(b);\n        Console.WriteLine(c);\n        Console.WriteLine(d);\n    }\n}<\/pre>\n<p>Example shows the logical and operator.<br \/>\nIt evaluates to true only if both operands are true.<\/p>\n<pre>$ .\/andoperator.exe \nTrue\nFalse\nFalse\nFalse<\/pre>\n<hr \/>\n<p>The logical or || operator evaluates to true,<br \/>\nif either of the operands is true.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        bool a = true || true;\n        bool b = true || false;\n        bool c = false || true;\n        bool d = false || false;\n\n        Console.WriteLine(a);\n        Console.WriteLine(b);\n        Console.WriteLine(c);\n        Console.WriteLine(d);\n    }\n}<\/pre>\n<p>If one of the sides of the operator is true, the outcome of<br \/>\nthe operation is true.<\/p>\n<pre>$ .\/orop.exe \nTrue\nTrue\nTrue\nFalse<\/pre>\n<hr \/>\n<p>The negation operator ! makes true false and false true.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        Console.WriteLine(! true);\n        Console.WriteLine(! false);\n        Console.WriteLine(! (4 &lt; 3));\n    }\n}<\/pre>\n<p>The example shows the negation operator in action.<\/p>\n<pre>$ .\/negation.exe \nFalse\nTrue\nTrue<\/pre>\n<hr \/>\n<p>The <code>||<\/code>, and <code>&amp;&amp;<\/code> operators<br \/>\nare short circuit evaluated. <b>Short circuit evaluation<\/b> means<br \/>\nthat the second argument is only evaluated if the first argument does<br \/>\nnot suffice to determine the value of the expression: when the first<br \/>\nargument of the logical and evaluates to false, the overall value must<br \/>\nbe false; and when the first argument of logical or evaluates to true,<br \/>\nthe overall value must be true. (wikipedia)<br \/>\nShort circuit evaluation is used mainly to improve performance.<\/p>\n<p>An example may clarify this a bit more.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        Console.WriteLine(\"Short circuit\");\n        if (One() &amp;&amp; Two())\n        {\n            Console.WriteLine(\"Pass\");\n        }\n\n        Console.WriteLine(\"#############\");\n        if (Two() || One())\n        {\n            Console.WriteLine(\"Pass\");\n        }\n    }\n\n    public static bool One()\n    {\n        Console.WriteLine(\"Inside one\");\n        return false;\n    }\n\n    public static bool Two()\n    {\n        Console.WriteLine(\"Inside two\");\n        return true;\n    }\n}<\/pre>\n<p>We have two methods in the example. They are used as operands<br \/>\nin boolean expressions. We will see, if they are called or not.<\/p>\n<pre>if (One() &amp;&amp; Two())\n{\n    Console.WriteLine(\"Pass\");\n}<\/pre>\n<p>The One() method returns false. The short circuit &amp;&amp;<br \/>\ndoes not evaluate the second method. It is not necessary.<br \/>\nOnce an operand is false, the result of the logical conclusion is always<br \/>\nfalse. Only &#8220;Inside one&#8221; is only printed to the console.<\/p>\n<pre>Console.WriteLine(\"#############\");\nif (Two() || One())\n{\n    Console.WriteLine(\"Pass\");\n}<\/pre>\n<p>In the second case, we use the || operator and use the Two()<br \/>\nmethod as the first operand.<br \/>\nIn this case, &#8220;Inside two&#8221; and &#8220;Pass&#8221; strings are printed to<br \/>\nthe terminal. It is again not necessary to evaluate the second<br \/>\noperand, since once the first operand evaluates to true, the<br \/>\nlogical or is always true.<\/p>\n<pre>$ .\/shortcircuit.exe \nShort circuit\nInside one\n#############\nInside two\nPass<\/pre>\n<p>Result of the shorcircuit.exe program.<\/p>\n<h2>Relational Operators<\/h2>\n<p>Relational operators are used to compare values. These operators always<br \/>\nresult in boolean value. Relational operators are also called comparison<br \/>\noperators.<\/p>\n<table>\n<tbody>\n<tr>\n<th>Symbol<\/th>\n<th>Meaning<\/th>\n<\/tr>\n<tr>\n<td>&lt;<\/td>\n<td>less than<\/td>\n<\/tr>\n<tr>\n<td>&lt;=<\/td>\n<td>less than or equal to<\/td>\n<\/tr>\n<tr>\n<td>&gt;<\/td>\n<td>greater than<\/td>\n<\/tr>\n<tr>\n<td>&gt;=<\/td>\n<td>greater than or equal to<\/td>\n<\/tr>\n<tr>\n<td>==<\/td>\n<td>equal to<\/td>\n<\/tr>\n<tr>\n<td>!=<\/td>\n<td>not equal to<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre>Console.WriteLine(3 &lt; 4); ' prints True\nConsole.WriteLine(3 == 4); ' prints False\nConsole.WriteLine(4 &gt;= 3); ' prints True\nConsole.WriteLine(4 != 3); ' prints True<\/pre>\n<p>In C# we use the == to compare numbers. Some languages<br \/>\nlike Ada, Visual Basic, or Pascal use = for comparing numbers.<\/p>\n<h2>Bitwise operators<\/h2>\n<p>Decimal numbers are natural to humans. Binary numbers are native to computers.<br \/>\nBinary, octal, decimal or hexadecimal symbols are only notations of the same number.<br \/>\nBitwise operators work with bits of a binary number. Bitwise operators are seldom<br \/>\nused in higher level languages like C#.<\/p>\n<table>\n<tbody>\n<tr>\n<th>Symbol<\/th>\n<th>Meaning<\/th>\n<\/tr>\n<tr>\n<td>~<\/td>\n<td>bitwise negation<\/td>\n<\/tr>\n<tr>\n<td>^<\/td>\n<td>bitwise exclusive or<\/td>\n<\/tr>\n<tr>\n<td>&amp;<\/td>\n<td>bitwise and<\/td>\n<\/tr>\n<tr>\n<td>|<\/td>\n<td>bitwise or<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The <b>bitwise negation operator<\/b> changes each 1 to 0 and 0 to 1.<\/p>\n<pre>Console.WriteLine(~ 7); \/\/ prints -8\nConsole.WriteLine(~ -8); \/\/ prints 7<\/pre>\n<p>The operator reverts all bits of a number 7. One of the bits also determines,<br \/>\nwhether the number is negative or not. If we negate all the bits one more<br \/>\ntime, we get number 7 again.<\/p>\n<p>The <b>bitwise and operator<\/b> performs bit-by-bit comparison between two numbers.<br \/>\nThe result for a bit position is 1 only if both corresponding bits in the operands are 1.<\/p>\n<pre>      00110\n   &amp;  00011\n   =  00010<\/pre>\n<p>The first number is a binary notation of 6. The second is 3. The result is 2.<\/p>\n<pre>Console.WriteLine(6 &amp; 3); \/\/ prints 2\nConsole.WriteLine(3 &amp; 6); \/\/ prints 2<\/pre>\n<p>The <b>bitwise or operator<\/b> performs bit-by-bit comparison between two numbers.<br \/>\nThe result for a bit position is 1 if either of the corresponding bits in the operands is 1.<\/p>\n<pre>     00110\n   | 00011\n   = 00111<\/pre>\n<p>The result is <code>00110<\/code> or decimal 7.<\/p>\n<pre>Console.WriteLine(6 | 3); \/\/ prints 7\nConsole.WriteLine(3 | 6); \/\/ prints 7<\/pre>\n<p>The <b>bitwise exclusive or operator<\/b> performs bit-by-bit comparison between two numbers.<br \/>\nThe result for a bit position is 1 if one or the other (but not both)<br \/>\nof the corresponding bits in the operands is 1.<\/p>\n<pre>      00110\n   ^  00011\n   =  00101<\/pre>\n<p>The result is <code>00101<\/code> or decimal 5.<\/p>\n<pre>Console.WriteLine(6 ^ 3); \/\/ prints 5\nConsole.WriteLine(3 ^ 6); \/\/ prints 5<\/pre>\n<h2>Compound assignment operators<\/h2>\n<p>The compound assignment operators consist of two operators.<br \/>\nThey are shorthand operators.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {\n        int a = 1;\n        a = a + 1;\n\n        Console.WriteLine(a); \/\/ prints 2\n\n        a += 5;\n        Console.WriteLine(a); \/\/ prints 7\n    }\n}<\/pre>\n<p>The += compound operator is one of these shorthand operators.<br \/>\nThey are less readable than the full expressions but<br \/>\nexperienced programmers often use them.<\/p>\n<p>Other compound operators are:<\/p>\n<pre>-=   *=   \/=   %=   &amp;=   |=   &lt;&lt;=   &gt;&gt;=<\/pre>\n<h2>Type information<\/h2>\n<p>Now we will concern ourselves with operators that work with<br \/>\ntypes.<\/p>\n<p>The <code>sizeof<\/code> operator is used to obtain the size<br \/>\nin bytes for a value type. The <code>typeof<\/code> is<br \/>\nused to obtain the System.Type object for a type.<\/p>\n<pre>using System;\n\npublic class CSharpApp\n{\n    static void Main()\n    {   \n        Console.WriteLine(sizeof(int));\n        Console.WriteLine(sizeof(float));\n        Console.WriteLine(sizeof(Int32));\n\n        Console.WriteLine(typeof(int));\n        Console.WriteLine(typeof(float));\n    }\n}<\/pre>\n<p>We use the <code>sizeof<\/code> and <code>typeof<\/code> operators.<\/p>\n<pre>$ gmcs sizetype.cs\n$ .\/sizetype.exe \n4\n4\n4\nSystem.Int32\nSystem.Single<\/pre>\n<p>Output. We can see, that the <code>int<\/code> type is an<br \/>\nalias for <code>System.Int32<\/code> and the <code>float<\/code><br \/>\nis an alias for the <code>System.Single<\/code> type.<\/p>\n<hr \/>\n<p>The <code>is<\/code> operator checks if an object is compatible<br \/>\nwith a given type.<\/p>\n<pre>using System;\n\nclass Base {}\nclass Derived : Base {}\n\npublic class CSharpApp\n{\n    static void Main()\n    {    \n        Base _base = new Base();\n        Derived derived = new Derived();\n\n        Console.WriteLine(_base is Base);\n        Console.WriteLine(_base is Object);\n        Console.WriteLine(derived is Base);\n        Console.WriteLine(_base is Derived);\n    }\n}<\/pre>\n<p>We create two objects from user defined types.<\/p>\n<pre>class Base {}\nclass Derived : Base {}<\/pre>\n<p>We have a Base and a Derived class. The Derived class<br \/>\ninherits from the Base class.<\/p>\n<pre>Console.WriteLine(_base is Base);\nConsole.WriteLine(_base is Object);<\/pre>\n<p>Base equals Base and so the first line print True.<br \/>\nA Base is also compatible with <code>Object<\/code> type. This is<br \/>\nbecause each class inherits from the mother of all classes,<br \/>\nthe <code>Object<\/code> class.<\/p>\n<pre>Console.WriteLine(derived is Base);\nConsole.WriteLine(_base is Derived);<\/pre>\n<p>The derived object is compatible with the<br \/>\nBase class, because it explicitly inherits from<br \/>\nthe Base class. On the other hand, the _base<br \/>\nobject has nothing to do with the Derived class.<\/p>\n<pre>$ .\/isoperator.exe \nTrue\nTrue\nTrue\nFalse<\/pre>\n<p>Output of example.<\/p>\n<hr \/>\n<p>The <code>as<\/code> operator is used to perform conversions between compatible<br \/>\nreference types. When the conversion is not possible, the operator returns null.<br \/>\nUnlike the cast operation which raises an exception.<\/p>\n<pre>using System;\n\nclass Base {}\nclass Derived : Base {}\n\npublic class CSharpApp\n{\n    static void Main()\n    {    \n        object[] objects = new object[6];\n        objects[0] = new Base();\n        objects[1] = new Derived();\n        objects[2] = \"ZetCode\";\n        objects[3] = 12;\n        objects[4] = 1.4;\n        objects[5] = null;\n\n        for (int i=0; i&lt;objects.Length; ++i) \n        {\n            string s = objects[i] as string;\n            Console.Write (\"{0}:\", i);\n\n            if (s != null)\n                Console.WriteLine (s);\n            else\n                Console.WriteLine (\"not a string\");\n        }\n    }\n}<\/pre>\n<p>In the above example, we use the <code>as<\/code> operator to<br \/>\nperform casting.<\/p>\n<pre>string s = objects[i] as string;<\/pre>\n<p>We try to cast various types to the string type. But only<br \/>\nonce the casting is valid.<\/p>\n<pre>$ .\/asoperator.exe \n0:not a string\n1:not a string\n2:ZetCode\n3:not a string\n4:not a string\n5:not a string<\/pre>\n<p>Output.<\/p>\n<hr \/>\n<h2>Expression<\/h2>\n<p>An expression is a fragment of code that can be evaluated to a single value, object, method, or namespace. Expressions can contain a literal value, a method invocation, an operator and its operands, or a simple name. Simple names can be the name of a variable, type member, method parameter, namespace or type.<\/p>\n<p>Expressions can use operators that in turn use other expressions as parameters, or method calls whose parameters are in turn other method calls, so expressions can range from simple to very complex.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Literals and Simple Names<\/strong><\/span><\/p>\n<p>The two simplest types of expressions are literals and simple names. A literal is a constant value that has no name. For example, in the following code example, both 5 and &#8220;Hello World&#8221; are literal values:<\/p>\n<p>int i = 5;<br \/>\nstring s = &#8220;Hello World&#8221;;<\/p>\n<p>In the example above, both i and s are simple names identifying local variables. When those variables are used in an expression, the value of the variable is retrieved and used for the expression. For example, in the following code example, when DoWork is called, the method receives the value 5 by default and is not able to access the variable var:<\/p>\n<p>int var = 5;<br \/>\nDoWork(var);<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Invocation Expressions<\/strong><\/span><br \/>\nIn the following code example, the call to DoWork is another kind of expression, called an invocation expression.<\/p>\n<p>DoWork(var);<\/p>\n<p>Specifically, calling a method is a method invocation expression. A method invocation requires the name of the method, either as a name as in the previous example, or as the result of another expression, followed by parenthesis and any method parameters. A delegate invocation uses the name of a delegate and method parameters in parenthesis. Method invocations and delegate invocations evaluate to the return value of the method, if the method returns a value. Methods that return void cannot be used in place of a value in an expression.<\/p>\n<div class=\"apply\">\n<h3>Apply for C Sharp Certification Now!!<\/h3>\n<p><a href=\"https:\/\/www.vskills.in\/certification\/Certified-C-sharp-Professional\" target=\"_blank\" rel=\"noopener\">https:\/\/www.vskills.in\/certification\/Certified-C-sharp-Professional<\/a><\/p>\n<h4><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/certified-c-professional\/\" target=\"_blank\" rel=\"noopener\"><strong>Back to Tutorial<\/strong><\/a><\/h4>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Operators and expressions Operators C# provides a large set of operators, which are symbols that specify which operations to perform in an expression. Operations on integral types such as ==, !=, &lt;, &gt;, &lt;=, &gt;=, binary +, binary &#8211;, ^, &amp;, |, ~, ++, &#8212;, and sizeof() are generally allowed on enumerations. In addition, many&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[3351],"tags":[],"class_list":["post-22278","page","type-page","status-publish","hentry","category-c-sharp"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Operators and expressions - Tutorial<\/title>\n<meta name=\"description\" content=\"Operators and expressions. Govt of India Certification for C#-Professional. Get Certified and improve employability. Certification assesses candidates in C#.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Operators and expressions - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Operators and expressions. Govt of India Certification for C#-Professional. Get Certified and improve employability. Certification assesses candidates in C#.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:46:46+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"16 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/\",\"name\":\"Operators and expressions - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2013-05-13T06:02:14+00:00\",\"dateModified\":\"2024-04-12T08:46:46+00:00\",\"description\":\"Operators and expressions. Govt of India Certification for C#-Professional. Get Certified and improve employability. Certification assesses candidates in C#.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Operators and expressions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Operators and expressions - Tutorial","description":"Operators and expressions. Govt of India Certification for C#-Professional. Get Certified and improve employability. Certification assesses candidates in C#.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/","og_locale":"en_US","og_type":"article","og_title":"Operators and expressions - Tutorial","og_description":"Operators and expressions. Govt of India Certification for C#-Professional. Get Certified and improve employability. Certification assesses candidates in C#.","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:46:46+00:00","twitter_misc":{"Est. reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/","name":"Operators and expressions - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2013-05-13T06:02:14+00:00","dateModified":"2024-04-12T08:46:46+00:00","description":"Operators and expressions. Govt of India Certification for C#-Professional. Get Certified and improve employability. Certification assesses candidates in C#.","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-and-expressions-of-c-sharp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Operators and expressions"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/22278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=22278"}],"version-history":[{"count":7,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/22278\/revisions"}],"predecessor-version":[{"id":132384,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/22278\/revisions\/132384"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=22278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=22278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=22278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}