100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
subtema en el lenguaje c# $6.49
Add to cart

Class notes

subtema en el lenguaje c#

 1 view  0 purchase
  • Course
  • Institution

descripcion y enfoque de tablas hash

Preview 1 out of 3  pages

  • August 12, 2022
  • 3
  • 2022/2023
  • Class notes
  • Isc
  • All classes
avatar-seller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// Crear una tabla hash utilizando la clase Hashtable disponible en
Collections

Hashtable thash1 = new Hashtable();/*La tabla se llama thashl, pero puede ser
cualquier nombre*/

// Agregando elementos a la tabla hash
//los valores pueden duplicarse pero no las claves
thash1.Add("txt", "Programa notepad.exe");
thash1.Add("bmp", "Pnograma paint.exe");
thash1.Add("dib", "Pnograna paint.exe");
thash1.Add("rtf", "Pnograma wordpad.exe");

//Comprobación de validación de que no se admiten llaves duplicadas

try{
thash1.Add("txt", "Programa winword.exe") ;

}catch{

Console.WriteLine("Un elemento con la clave = \"txt\" Ya existe \n");
}

//podemos obtener el valor utilizando la clave
Console.WriteLine("--------------------");
Console.WriteLine("Imprimimos un valor de la tabla usando la clave");
Console.WriteLine("Para la Clave = \"rtf\", valor = {0} ", thash1["rtf"] + "\n");

//También podemos cambiar el valor utilizando la clave thash1[”rtf”] =
"recortes.exe";
Console.WriteLine("------------------------");
Console.WriteLine("Cambiando valor asociado a clave rtf");
Console.WriteLine("Para la clave= \"rtf\", valor = {0}.", thash1["rtf"]);
Console.WriteLine("\n-------------------");

//si la clave no existe, al utilizar esta sintaxis también se puede agregar igual
que add
thash1["doc"] = "winword.exe";

// Comai nsKey puede ser usada para probar
// si una clave ya eXiste

if (!thash1.ContainsKey("ht"))
{
thash1.Add("ht", "hypertrm.exe");
Console.WriteLine("Valor Agregado para =\"ht\": {0}", thash1["ht"]);

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller natanielestrada. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $6.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

52928 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$6.49
  • (0)
Add to cart
Added