Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original
Este tópico ainda não foi avaliado como - Avalie este tópico

Console.Write Método (Int64)

Grava a representação de texto do valor especificado inteiro assinado de 64 bits para o fluxo de saída padrão.

Namespace:  System
Assembly:  mscorlib (em mscorlib. dll)
[HostProtectionAttribute(SecurityAction.LinkDemand, UI = true)]
public static void Write(
	long value
)

Parâmetros

value
Tipo: System.Int64
The valor to Gravar.
ExceçãoCondição
IOException

Ocorreu um erro de E/s.

ObservaçãoObservação:

O atributo HostProtectionAttribute aplicado a esse tipo ou membro tem o seguinte Resources valor da propriedade: UI. O HostProtectionAttribute não afeta área de trabalho aplicativos (que são geralmente iniciado por duas vezes em um ícone, digitando um comando ou inserindo um URL em um navegador). Para obter mais informações, consulte a classe HostProtectionAttribute ou Programação SQL Servidor e atributos de proteção de host.

The text representation of value is produced by calling the Int64.ToString method.

The following code example illustrates the use of the Write method.

public class FormatConverter {
    public static void Main(string[] args) {
        string lineInput;
        while ((lineInput = Console.ReadLine()) != null) {
            string[] fields = lineInput.Split(new char[] {'\t'});
            bool isFirstField = true;
            foreach(string item in fields) {
                if (isFirstField)
                    isFirstField = false;
                else
                    Console.Write(',');
                // If the field represents a boolean, replace with a numeric representation.
                try {
                    Console.Write(Convert.ToByte(Convert.ToBoolean(item)));
                }
                catch(FormatException) {
                    Console.Write(item);
                }
            }
            Console.WriteLine();
        }
    }
}


public class FormatConverter
{
    public static void main(String[] args)
    {
        String lineInput;

        while (((lineInput = Console.ReadLine()) != null)) {
            String fields[] = lineInput.Split(new char[] { '\t' });
            boolean isFirstField = true;
            String item = null;
            for (int iCtr = 0; iCtr < fields.length; iCtr++) {
                item = fields[iCtr];
                if (isFirstField) {                
                    isFirstField = false;
                }
                else {                
                    Console.Write(',');
                } 
                // If the field represents a boolean, replace with a numeric 
                // representation.
                try {                
                    Console.Write(Convert.ToByte(Convert.ToBoolean(item)));
                }
                catch (FormatException exp) {                
                    Console.Write(item);
                }
            }
            Console.WriteLine();
        }
    } //main
} //FormatConverter


var lineInput : String;
while ((lineInput = Console.ReadLine()) != null) {
    var fields : String[] = lineInput.Split(char[](['\t']));
    var isFirstField : Boolean = true;
    for(var i in fields) {
        var item = fields[i];
        if (isFirstField)
            isFirstField = false;
        else
            Console.Write(',');
        // If the field represents a boolean, replace with a numeric representation.
        try {
            Console.Write(Convert.ToByte(Convert.ToBoolean(item)));
        }
        catch(FormatException) {
            Console.Write(item);
        }
    }
    Console.WriteLine();
}


Isso foi útil para você?
(1500 caracteres restantes)

Contribuições da comunidade

ADICIONAR
© 2013 Microsoft. Todos os direitos reservados.