Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Frase
- {
- string[] palabras = "GitHub Gist permite crear fragmentos de código de forma eficiente.".Split();
- public string this [int indicePalabra] // indexer
- {
- get
- {
- return palabras[indicePalabra];
- }
- set
- {
- palabras[indicePalabra] = value;
- }
- }
- public static void Main()
- {
- Frase f = new Frase();
- Console.WriteLine (f[1]); // Gist
- f[9] = "rápida";
- Console.WriteLine (f[9]); // rápida
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement