This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
///This function returns the nth decimal of Pi | |
/// </summary> | |
/// <param name="lugar"></param> | |
/// <returns></returns> | |
private int ObtenerDecimalNdePi(int lugar) | |
{ | |
double Pi = Math.PI; | |
double Potencia = Math.Pow(10, lugar); | |
double PotenciaFloor = Math.Pow(10, lugar-1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var miString = "Felipe"; | |
// Devulve el char 'F' | |
var primerChar = miString.First(); | |
var listadoNombres = new List<string>() { "Felipe", "Claudia" }; | |
// Devuelve el string "Felipe" | |
var primerNombre = listadoNombres.First(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Aquí guardaremos la fecha del usuario si tiene formato correcto | |
DateTime fecha; | |
string formato = "dd/MM/yyyy"; | |
// es-DO es el formato de República Dominicana | |
var provider = new CultureInfo("es-DO"); | |
// Uso un while true para que el usuario tenga infinitos intentos para colocar su fecha en formato correcto | |
while (true) | |
{ | |
Console.WriteLine("Ingrese una fecha en formato dd/MM/yyyy"); | |
string inputDelUsuario = Console.ReadLine(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<h4>Haciendo un acordeón con Bootstrap 3.3.6</h4> | |
<div class="panel-group" id="collapse"> | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<h4 class="panel-title"> | |
<a data-toggle="collapse" data-parent="#collapse" href="#seccion1"> | |
Sección 1 | |
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<h4>Haciendo un modal con Bootstrap 3.3.6</h4> | |
<input class="btn btn-default" type="button" data-toggle="modal" data-target="#myModal" value="Modal típico" /> | |
<input class="btn btn-primary" type="button" data-toggle="modal" data-target="#modal-login" value="Modal login" /> | |
</div> | |
<!--Modal típico--> | |
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"> | |
<div class="modal-dialog"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<h4>Haciendo un Carousel en Bootstrap 3.3.6</h4> | |
<div class="row"> | |
<div class="col-md-6"> | |
<div id="carousel-peliculas" class="carousel slide" data-ride="carousel" data-interval="5000"> | |
<ol class="carousel-indicators"> | |
<li data-target="#carousel-peliculas" data-slide-to="0" class="active"></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Si mi procedimiento almacenado tiene 3 parámetros, entro escribo tres lineas como estas: | |
cmd.Parameters.Add(new SqlParameter("@parametro1", "valor1")); | |
cmd.Parameters.Add(new SqlParameter("@parametro2", "valor2")); | |
cmd.Parameters.Add(new SqlParameter("@parametro3", "valor3")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<SelectListItem> ToListSelectListItem<T>() | |
{ | |
var t = typeof(T); | |
if (!t.IsEnum) { throw new ApplicationException("Tipo debe ser enum"); } | |
var members = t.GetFields(BindingFlags.Public | BindingFlags.Static); | |
var result = new List<SelectListItem>(); |
OlderNewer