Skip to content

Instantly share code, notes, and snippets.

@EdixonAlberto
Created March 21, 2022 04:30
Show Gist options
  • Save EdixonAlberto/f72a550e5bad5a919da6ec528589cab2 to your computer and use it in GitHub Desktop.
Save EdixonAlberto/f72a550e5bad5a919da6ec528589cab2 to your computer and use it in GitHub Desktop.
Comparación entre CSharp y Typescript

CSharp vs Typescript

Comparación entre lenguajes usando: namespace, static method, instance, callback, enum y types

CSharp

namespace Core.Utils
{
  public static class HttpUtil
  {
    public static Byte[] Download(Url url)
    {
      using (var client = new HttpClient())
      {
        return client.DownloadData(url);
      }
    }
  }
}

enum opers
{
  cancell,
  buy,
  sell
}

Typescript

namespace Core.Utils
{
  abstract class HttpUtil
  {
    public static Download(url: Url): Byte[]
    {
       return ((client = new HttpClient()) =>
       {
         return client.DownloadData(url)
       })()
    }
  }
}

enum opers
{
  cancell,
  buy,
  sell
}

// --------------------------------------------

class HttpClient {
  public DownloadData(url: Url): Byte[] {
    return
  }
}

type Url = string
type Byte = number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment