funciones en C#
struct Cliente {
public int codigo;
public string apellido;
public string nombre;
}
funciones en C#
struct Cliente {
public int codigo;
public string apellido;
public string nombre;
}
funciones en C#
void VerResultado() {
Console.WriteLine("¡¡¡Ganador!!!");
}
funciones en C#
Cliente c1, c2, c3;
c1.codigo = 200;
c1.nombre = "Juanjo";
c1.apellido = "Pedraza";
c2.codigo = 125;
c2.nombre = "Perico";
c2.apellido = "Palotes";
c3 = c1 + c2;
//Aquí el compilador daría error porque no se pueden aplicar el operando al tipo.
}
funciones en C#
private static string GetText(string path, string filename)
{
var reader = File.OpenText($"{AppendPathSeparator(path)}{filename}");
var text = reader.ReadToEnd();
return text;
string AppendPathSeparator(string filepath)
{
return filepath.EndsWith(@"\") ? filepath : filepath + @"\";
}
}
funciones en C#
#nullable enable
private static void Process(string?[] lines, string mark)
{
foreach (var line in lines)
{
if (IsValid(line))
{
// Processing logic...
}
}
bool IsValid([NotNullWhen(true)] string? line)
{
return !string.IsNullOrEmpty(line) && line.Length >= mark.Length;
}
}
funciones en C#
double calculoNeto(double Pbruto, double Tasa = 21);
funciones en C#
<modifiers> <return-type> <method-name> <parameter-list>
funciones en C#
<modificador de acceso> <tipo de retorno> <Nombre de la función>(
[parámetro 1, [parámetro 2]...])
{
//Procesamientos
return <valor>;
}
funciones en C#
public static double CalculoNETO (double Pbruto, double Tasa) {
return Pbruto * (1+(Tasa/100));
}
...
double PrecioBruto = 100;
double PrecioNeto;
PrecioNeto = TestEstructura.CalculoNETO(PrecioBruto, 5.5);
Console.WriteLine(PrecioNeto);
funciones en C#
double calculoNeto(double Pbruto, double Tasa = 21; String divisa);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us