Skip to content

Instantly share code, notes, and snippets.

View elGuille-info's full-sized avatar

Guillermo Som elGuille-info

View GitHub Profile
@elGuille-info
elGuille-info / Evaluar.java
Created November 16, 2022 18:22
Evaluar expresiones con Java y record
// Evaluar expresiones simples usando los record definidos en SealedRecord.
// Se permite *, /, +, - con este nivel de precedencia.
// Las expresiones entre paréntesis se evalúan primero.
//
// op1 + op2 * op3 se evalúa como op1 + (op2*op3)
// op1 * op2 + op3 se evalúa como (op1*op2) + op3
//package com.example.evaluar;
Option Strict On
Option Infer On
'Imports System
'Imports System.Windows.Forms
Imports System.Diagnostics
Imports System.Linq
Imports System.Xml
@elGuille-info
elGuille-info / novedadescs9_07.cs
Last active November 15, 2020 19:19
Actualización de novedadescs9_07 (con GUID f475fdf66fc291fbd220ac9393d9b0e8)
// # novedadescs9_07
// Crear un record partial
// Definir Deconstruct para los 3 argumentos
using System;
Console.WriteLine(@"Crear un record partial
Definir Deconstruct para los 3 argumentos
");
// # novedadescs9_07
using System;
// Crear una nueva instancia de un tipo de registro (record)
var persona = new Persona("Guillermo", 1957);
// Mostrarerá todas las propiedades
Console.WriteLine($"persona: {persona}");
//Console.WriteLine();
// # novedadescs9_06
using System;
var persona = new Person() with {FirstName = "Guillermo", LastName = "Som"};
Console.WriteLine($"persona: {persona}");
var (f, l) = persona;
Console.WriteLine($"{f} {l}");
' # pruebaVB_07
Option Strict On
Option Infer On
Imports System
Imports System.Text
Imports System.Reflection
Imports System.Collections.Generic
' # pruebaVB_06
Option Strict On
Option Infer On
Imports System
Imports System.Text
Imports System.Reflection
Imports System.Collections.Generic
' # ejemplo 1
Imports System
Module Program
Sub Main(args As String())
Console.WriteLine("Hello World!")
dim persona1 = New Persona With { .Nombre = "Guillermo", .Edad = 63 }
'Console.WriteLine($"persona1: {persona1.Nombre} {persona1.Edad}")
using System;
var persona = new Persona("Guillermo", 63);
Console.WriteLine("La persona: {0}.", persona);
var (n, e) = persona;
Console.WriteLine($"{n} {e}");
public record Persona(string Nombre, int Edad);