Questions tagged as 'c#'

1
answer

Make comparison using String.Contains () disregarding accents and case

I need to check how to make a comparison between strings , in C #, using the Contains() method that disregards both accent sensitivity and case / strong> of a string . Example: var mainStr = "Acentuação"; mainStr.Contains("acen...
asked by 24.01.2017 / 19:03
2
answers

Sort List by by descending values

I have a Chromosome object : public List<int> Rotas { get; set; } public int ValorFitness { get; set; } And I also have a list of this object List<Cromossomo> . I would like to sort this list by the property ValorFit...
asked by 09.07.2014 / 15:27
3
answers

try / catch does not show correct message

Staff have a my C # code that has the code: Uri resultadoURL; bool resultado = Uri.TryCreate(Configuracoes.Configuracao.URL, UriKind.Absolute, out resultadoURL) && resultadoURL.Scheme == Uri.UriSchemeHttp; if (!resultado) throw ne...
asked by 13.08.2014 / 20:24
2
answers

Understand class instantiation

I have a question and would like to better understand how class instantiation works. More specifically the most appropriate way of doing (if any) and the impacts of doing the wrong thing. Assuming these two scenarios, which one should I use a...
asked by 25.07.2014 / 19:57
1
answer

How to save an XLSX (Excel) file instead of CSV?

Today I have the code below, which saves a file in CSV format. What do I need to change to save in XLSX (Excel) format? public static void buildCSV(string filename = "resultado.xlsx") { Console.WriteLine("Escrevendo no a...
asked by 30.11.2018 / 22:23
2
answers

Serializing and deserializing Json objects with C #

Consider the JSON below { "atividade_principal": [ { "text": "Atividades de televisão aberta", "code": "60.21-7-00" } ], "data_situacao": "03/11/2005", "nome": "GLOBO COMUNICACAO E PARTICIPACOES S/A", "uf": "RJ",...
asked by 28.11.2016 / 18:17
1
answer

How to treat in C # data coming from a table that is of type bit in sql server?

In Visual Studio it will look like this: alerta.DataHoraCadastro = dr.Get(12); How do I do this?     
asked by 01.12.2016 / 20:03
1
answer

How to call a View passing parameters through json

I have this code that passes parameters to my controller: var id = $(Musico).val(); var url = '@Url.Action("Votar","Chamada")'; var tipo = 1; $.ajax({ url: url, data: { id:id, tipo:tipo } }); My controller: public...
asked by 25.11.2016 / 02:55
1
answer

Can you use C ++ and C # using C programming?

If I put a code for a sotfware and this code wants to use the C, C ++ and C # languages, could it? Even if I use a compiler that reads all three?     
asked by 02.12.2016 / 14:51
3
answers

List of Exceptions

How to implement a class so that I can add an exception to an exception list. This class would be used for the case below, for example: In the validation method it can return one or more errors, so each error is added an exception in the l...
asked by 11.02.2016 / 14:16