Questions tagged as 'c#'

4
answers

Variable in message box c #

How to put a variable within the message box? The code comes down I think it's self explanatory. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; us...
asked by 24.08.2017 / 10:08
3
answers

ListBox selection

Every time you move an item up or down a listBox it loses the focus of the item. I can not always focus on the item. For example: suppose my list has 200 items. So I want to move the item that is in position 160 to the 159, so once...
asked by 27.07.2017 / 15:19
3
answers

Why do you print the variable type instead of the result?

See the method below: public void TesteLambda() { List<String> selecoes = new List<string>(); selecoes.Add("USA"); selecoes.Add("Brasil"); selecoes.Add("Itália"); selecoes...
asked by 17.08.2017 / 08:52
2
answers

What are the model and model variables in a View?

What are the @model and Model variables in a view ? In my view I use this at the beginning of the code: @using Html5DataList.Models @model List<Estabelecimento> And to access the data, I use it like this: @foreac...
asked by 29.07.2017 / 15:45
2
answers

How to do query containing MAX and COUNT via LINQ

I have the following model : public class Crm_Analise { [Key] public int id { get; set; } public string cod_item_CRM { get; set; } public string TAG { get; set; } public string data_creat { get; set; } public str...
asked by 14.07.2017 / 13:26
1
answer

Handling Exceptions of Different Types

try { await DoFooAsync(); } catch (Exception e) { if(e is TaskCancelledException || e is UnauthorizedAccessException) { // ... } throw; } The block catch of the above excerpt checks the type of exception captured...
asked by 22.09.2017 / 05:51
1
answer

How to create a class at runtime?

How to create a runtime class, or runtime , dynamically from a Dictionary<TKey, TValue> , for example, with C #? Dictionary<string, string> dicionario = new Dictionary<string, string>(); dicionario.Add("nome", "string"...
asked by 23.02.2017 / 22:42
2
answers

NewtonJson.Parse with quotation marks in the middle

I have a column of type varchar in the database that takes a JSON. This column is the description of a company, but in 4 languages. The logic I have is as follows: { "PT":"Descrição com "aspas" quebra o meu código", "ES":" "...
asked by 01.03.2017 / 16:10
3
answers

Can not implicitly convert type 'string' to 'int'

protected void btnSave_Click(object sender, EventArgs e) { List<ProdutoAmortizacaoCreditoDias> aDay = new List<ProdutoAmortizacaoCreditoDias>(); ProdutoAmortizacaoCreditoDias ee = new ProdutoAmortizacaoCreditoDias(...
asked by 10.02.2017 / 18:57
2
answers

Modeling Models 1 to n

I'm modeling a system for Academies. I created 2 models, Modality public class Modalidade { [Key] public int ModalidadeId { get; set; } [MaxLength(200)] public string Nome { get; set; } [Newt...
asked by 22.09.2016 / 14:43