Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

The implicit keyword is used to declare an implicit user-defined type conversion operator.
In other words, this gives the power to your C# class, which can accepts any reasonably convertible data type without type casting. And such a kind of class can also be assigned to any convertible object or variable. e.g.

Code Block
class MyType 
{
   public static implicit operator int(MyType m) 
   {
      // code to convert from MyType to int
   }
}

e.g. within DeltaShell

Code Block
public string Path { get; set; }

public static implicit operator TestDataPath(string path)
{
     return new TestDataPath { Path = path };
}

public static class Plugins
{
     public static class Habitat
     {
         public static readonly TestDataPath DeltaShellPluginsImportersHabitatTests = "DeltaShell.Plugins.Habitat.Tests";
         public static readonly TestDataPath DeltaShellPluginsHabitatTests = "DeltaShell.Plugins.Habitat.Tests";
     }
}