marceloviana
marceloviana
Reputation Top 1%
Marcelo Viana
14 Snippets  (62nd place)
Published
1 Channel
Created
4 Channels
Following
Nov 3, 2018
Last Visit
Sep 29, 2016
Registered
577 points  (59th place)
Reputation
Top 10% Publisher
Junior Code Generator
Serious Code Generator
Senior Code Generator
Junior Publisher
Serious Publisher
Junior Trend Maker
Junior Popular Coder
Junior Autobiographer
Senior Autobiographer
Serious Famous Coder
Senior Famous Coder

Recent Snippets See all snippets by marceloviana

public by marceloviana created Nov 3, 2018  49  0  2  0

Acessando sub linhas de um json

String json_resultado = "{\"hasErrors\":true,\"errors\":[{\"reference\":\"AcordoApplication\",\"message\":\"18 - Não existem dívidas pendentes.\"}]}";
        
       var jObject = Newtonsoft.Json.Linq.JObject.Parse(json_resultado.ToString());

       foreach (var itens in jObject["errors"]) {

           String resultado = itens["message"].ToString();

       };
;

public by marceloviana created Aug 4, 2018  462  1  4  0

Percorrer json

foreach (var keyvalue in context_id)
        {

            
            text = text + "</br><b>" + keyvalue.Name + "</b>  " + keyvalue.Value;
        }
;

public by marceloviana created May 26, 2017  359  2  4  0

Chamando função assincrona via console

static void Main()
{
    RunAsync().Wait();
}

private static async Task RunAsync()
{
    …
}
;

public by marceloviana created Mar 29, 2017  858  0  4  0

Converte string em UFT-8

byte[] bytes = Encoding.Default.GetBytes(myString);
myString = Encoding.UTF8.GetString(bytes);
;

public by marceloviana created Dec 19, 2016  3000  0  4  0

Formatar double para ,00

//Converte double 

double valor = double.Parse("100".ToString());

string.Format("{0:n2}", decimal.Parse(valor.ToString())
;