No tienes acceso a esta clase

¡Continúa aprendiendo! Únete y comienza a potenciar tu carrera

No se trata de lo que quieres comprar, sino de quién quieres ser. Invierte en tu educación con el precio especial

Antes: $249

Currency
$209

Paga en 4 cuotas sin intereses

Paga en 4 cuotas sin intereses
Suscríbete

Termina en:

12 Días
13 Hrs
21 Min
19 Seg

Evolución de C#

10/14
Recursos

Aportes 10

Preguntas 2

Ordenar por:

¿Quieres ver más aportes, preguntas y respuestas de la comunidad?

De las caracteristicas a lo largo de c#, la de las tuplas me parece muy genial, se me hace muy similar a Go en ese aspecto para retornar multiples valores.

mi aporte todos los ejemplos que mostro el profesor en codigo:

int menuSelected = 0;
do
{
menuSelected = ShowMainMenu();
if ((Menu)menuSelected == Menu.mnInterp)
{
stringinterpol();
}
if ((Menu)menuSelected == Menu.mnbfunct)
{
Console.WriteLine(sumwithbodied(14,28));
Console.ReadKey();
}
if ((Menu)menuSelected == Menu.mncondoper)
{
condoper();
}
if ((Menu)menuSelected == Menu.mnsumlocal)
{
Console.WriteLine($"La Suma es: " + Sumlocalfunctions(154,28));
}
if ((Menu)menuSelected == Menu.mndigsep)
{
const long BillonsAndBillon =100_000_000_000;
Console.WriteLine(BillonsAndBillon);
}
if ((Menu)menuSelected == Menu.mntuples)
{
var named = Tuple.Create(48, “Jose Angel”, “Soriano”);
DisplayTuple(named);
}

            if ((Menu)menuSelected == Menu.mnswitch)
            {
                  var gitem = 6;

                    var res = gitem switch {
                        2 => "Hello",
                        4 => "Bonjour",
                        6 => "Namaste",
                        8 => "Anyoung haseyo",
                        _ => "No greeting found",
                    };
                       Console.WriteLine(res);
                       Console.WriteLine("-------------------");
            }

} while ((Menu)menuSelected  != Menu.Exit);

int ShowMainMenu()
{
Console.WriteLine("----------------------------------------");
Console.WriteLine("Enter improvements C# on time: ");
Console.WriteLine("1. C# 6 String Interpolation ");
Console.WriteLine(“2. C# 6 Expression Bodied Function”);
Console.WriteLine(“3. C# 6 Null Conditional Operator”);
Console.WriteLine(“4. Local Functions”);
Console.WriteLine(“5. C# 7 Digital Separator”);
Console.WriteLine(“6. C# 7 Tuples”);
Console.WriteLine(“7. C# 8 Switch Expression”);
Console.WriteLine(“8. Salir”);
// Read line
string menuSelected = Console.ReadLine();
return Convert.ToInt32(menuSelected);
}

    void stringinterpol()
    {
        string myVar = "JOse Angel Soriano";
        Console.WriteLine($"The message is: {myVar} ");
    }

    int sumwithbodied(int x, int y) => (x+y);

    static void condoper()
    {
        try
        {
            DateTime? datetime = new DateTime();
            //using ? asking if the value is null
            var YearofDate = datetime?.Year;
            Console.WriteLine(YearofDate);

            var YearofDateConditional = datetime?.Year ?? 0;
        }
        catch(Exception)
        {
          Console.WriteLine("Ha ocurrido un error al eliminar el Menu 1a");  
        }
    }

    int Sumlocalfunctions(int x, int y)
        {
            return x + y ;
        }

    static void DisplayTuple(Tuple<int,string,string> named)
        {
            Console.WriteLine($"Edad = { named.Item1}");
            Console.WriteLine($"First Name = { named.Item2}");
            Console.WriteLine($"Last Name = { named.Item3}");
        }


       public enum Menu
        {
            mnInterp   =  1,
            mnbfunct   =  2,
            mncondoper =  3,
            mnsumlocal =  4,
            mndigsep   =  5,
            mntuples   =  6,
            mnswitch  =  7,
            Exit = 8
        }
creo que es uno de los lenguajes de programación mas dinámicos y que esta tenido muy buenas mejoras

tambien existen notebooks de c# como lo son en python y funciona solo con .net

Esta clase estaba muy buena :3

Actualmente es C#12 y en Beta ya .NET 9 que incluye C#13
"**Evolution of C#** ## **C# 6** ### **Auto Property Initializer** * Allows initializing a default value to a property within a class. public string MyVar { get; set; } = "Hello world"; ### **String Interpolation** * Provides a cleaner and more intuitive way to concatenate strings. string MyString = "Hello world"; Console.WriteLine($"The message is: {MyString}"); ### **Expression-bodied Function** * Enables faster function creation using the arrow operator (`=>`), akin to JavaScript arrow functions. public int Sum(int x, int y) => (x + y); ### **Null Conditional Operator** * Allows checking if a property is null before evaluation, avoiding the need for an if conditional. DateTime? datetime = new DateTime(); // Using "?" to check if the value is null var YearOfDate = datetime?.Year; Console.WriteLine(YearOfDate); var YearOfDateConditional = datetime?.Year ?? 0; ## **C# 7** ### **Local Functions** * Enables creating functions within functions, allowing functions within methods. static void Main(string\[] args) { int Sum(int x, int y) { return x + y; } Console.WriteLine(Sum(10, 20)); Console.ReadKey(); } ### **Digit Separator** * Enables using the "\_" character to separate numbers into groups of 3 for readability. public const long BillionsAndBillions = 100\_000\_000\_000; ### **Tuples** * Allows returning combinations of different values and types when returning both primitive types and composed values. var named (first: "one", second: "two"); // Method returning a tuple (bool bresult, double dcalculation) = Tuples.CalculationTuple(); ## **C# 8** ### **Switch Expression** * Reduces the syntax of switch statements when only returning a value. // Switch as expression int intValueForSwitch = 0; var state = (intValueForSwitch) switch { (0) => "Zero", (1) => "One", (2) => "Two", (3) => "Three", \_ => "NO valid number" } ## **C# 9** ### **Top-Level Statements** * Allows running code directly in a code sheet without the need for a classic namespace. **Before**: using System; namespace HelloWorld { internal class Program { static void Main(string\[] args) { Console.WriteLine("Hello world"); } } } **After**: using System; Console.WriteLine("Hello world"); ## **C# 10** ### **Global Using** * Enables using methods without explicitly importing libraries since the code automatically detects which libraries are used. **Before**: using System; Console.WriteLine("Hello world"); **After**: Console.WriteLine("Hello world"); These improvements represent significant advancements in C# over time, enhancing developer productivity and code readability."

Evoluciones del codigo en C#

Grandes aportes.