Разни неща за WEB

на Биляна Чавдарова

Reading from Console

  • We use console to read information from the command line
  • We can read: Characters, Strings, Numeral types(after conversion)
  • To read from the console we use the methods Console.Read() and Console.ReadLine()

Console.ReadKey()

  • Waits until a combination of keys is pressed. Reads a single character from console or a combination of keys
  • Returns a result of type ConsoleKeyInfo
    • KeyChar – holds the entered character
    • Modifiers – holds the state of [Ctrl], [Alt],…

ConsoleKeyInfo key = Console.ReadKey();
Console.WriteLine();
Console.WriteLine("Character entered: " + key.KeyChar);
Console.WriteLine("Special keys: " + key.Modifiers);

Console.ReadLine()

  • Gets a line of characters.
  • Returns a string value.
  • Returns null if the end of the input is reached.


Console.Write("Please enter your first name: ");
string firstName = Console.ReadLine();

Console.Write(„Please enter your last name: „);
string lastName = Console.ReadLine();

Console.WriteLine(„Hello, {0}{1}!“, firstName, lastName);
Reading Numeral Types

  • Numeral types can not be read directly from the console
  • To read a numeral type do the following:
    1. Read a string value
    2. Convert(parse) it to the required numeral type
  • int.Parse(string)
    Parses(converts) a string to int
    string str = Console.ReadLine()
    int number = int.Parse(str);

    Console.WriteLine("You entered: {0}", number);

  • 0 Comments
  • Публикувано в: C#
  • Formatting string

    • {index[, alignment][:formatString]}

      Примери: {0,7} – Означава този аргумент да бъде вкаран 7 позиции на екрана. Ако числото е 25, това означава 5 интервала следвано от 25. Ако искаме да отпечатаме стринг „Били“ ще получим Били + 3 интервала, защото стринговете по подразбиране се подравняват в ляво.

    • index
      • The zero-based index of the argument whose string representation is to be included at this position in the string.
    • alignment
      • A signed integer that indicates the total length of the field into which the argument is inserted.
        - a positive integer – right-aligned
        - a negative integer – left-aligned

    Източник: http://academy.telerik.com/academy-courses/csharp-programming-fundamentals/video

  • 0 Comments
  • Публикувано в: C#
  • Console Input and Output methods

    продължава »

  • 0 Comments
  • Публикувано в: C#
  • Function overloading

    продължава »

  • 0 Comments
  • Публикувано в: C#
  • Special characters

    Among the special characters is also a Unicode character notation for writing any character.

    Character Meaning Character Meaning
    \n newline \f form feed
    \t horizontal tab \a alert sound
    \v vertical tab \’ single quote
    \b backspace \” double quote
    \r carriage return \\ backslash
    \0 null character \uFFFF Unicode character (4-digit hex number)

    Escape characters can be ignored by adding an “@” symbol before the string. This is called a verbatim string and can for example be used to make file paths more readable.

    string e = "c:\\Windows\\System32\\cmd.exe"; 
    string f = @"c:\Windows\System32\cmd.exe";
    
  • 0 Comments
  • Публикувано в: C#
  • Тестовете за качество на уеб сайт измерват неговият дизайн и ползваемост. Качественият и ефективен уебсайт получава висок трафик и page rank.

    Контролът на качеството съпровожда целият процес на създаване на даден уебсайт, включително и самият дизайн преди той да бъде финализиран. Необходимо е да бъдат включени както клиентите, така и обикновените потребители особено когато става въпрос за комерсиален сайт. Така се добива най-реална представа за продължава »

    Универсални съвети за хора предлагащи услуги свързани със сайтове и изводи до които съм достигнала благодарение на моят опит. Моля ако някой има забележки или иска да допълни нещо да напише коментар. продължава »

  • 0 Comments
  • Публикувано в: Работа с клиенти