El código:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace sumar
{
public class Class1
{
public double suma(double valor1, double valor2)
{
return valor1 + valor2;
}
}
}
Guardar el proyecto y una vez termine de escribir el código, presione ejecutar para generar la dll.
Aparecerá un cuadro de error pero ya se habrá creado nuestra DLL en la carpeta debug de
nuestro proyecto.
Dll EN C#. Programación II. Lic. Luis Antonio Amaya
Usando la dll
Crear otro proyecto con windowsform
Buscamos nuestra dll recién creada que se llama sumar.dll y dar click en aceptar.
MessageBox.Show(resultado.ToString());
TAREA: CREAR UNA CLASE QUE CONTENGA LAS CUATRO OPERACIONES BÁSICAS, EN LA DIVISIÓN CONSIDERE LA DIVISIÓN POR CERO!
Dll EN C#. Programación II. Lic. Luis Antonio Amaya
Dll EN C#. Programación II. Lic. Luis Antonio Amaya
Agregar:
using System.IO;
using System.Media;
Dll EN C#. Programación II. Lic. Luis Antonio Amaya
luego…..
además….
public repromusik()
{
InitializeComponent();
soundplayer = new SoundPlayer();
openFileDialog1.ShowDialog();
if (openFileDialog1.ShowDialog() == DialogResult.OK) {
soundplayer.SoundLocation = openFileDialog1.FileName;
}
Código de reproducir:
soundplayer.Play();
Código de Parar:
soundplayer.Stop();
Dll EN C#. Programación II. Lic. Luis Antonio Amaya
Mi Control!
using Microsoft.Win32;
APLICACION SHARE
Dll EN C#. Programación II. Lic. Luis Antonio Amaya