C# != OPERATORS

!= Not equal.Predefined value types, the inequality operator (!=) returns true if the values are different, false. If the reference types isn't a string, != returns true if its two operands points to different objects. String type, != compares the values of the strings.

Wiring and Schematics

Download Template

3D Printer Settings

Code

using System;

class InequalityTest
{
   static void Main()
   {
       // Numeric numbers that don't equal:
       Console.WriteLine((2 + 2) != 4);

       // Reference equality, two objects, same value
       object s = 1;
       object t = 1;
       Console.WriteLine(s != t);

       // Strings, same string objects
       string a = "howdy";
       string b = "howdy";

       // compare string values
       Console.WriteLine(a != b);

       // compare string references
       Console.WriteLine((object)a != (object)b);
   }
}
/*
Output:
False
True
False
False
*/

Things Used
AmieDD Software
  • Visual Studio Code
AmieDD Machines and Tools
AmieDD Character
AmieDD Cosplay Fandom

More Tutorials

I make everything with love and a few curse words.