Questions tagged as '.net'

2
answers

Convert hexadecimal to integer

I have this value in hexadecimal "E365A931A000000". I need to convert it to integer I'm using the following code. string hex = "E365A931A000000"; CodLibercao = Convert.ToInt32(hex); This code is giving me the following exception:    "...
asked by 03.03.2015 / 21:22
2
answers

How to make a struct in C #?

How to make a structure in C # where you create a type? For example, in C ++ we use: struct teste { int a; char c[30]; };     
asked by 03.01.2016 / 02:41
2
answers

How do I leave a RadioButton marked as default?

I have several radioButton's. How do I leave a marked as default? private void radioButton2_CheckedChanged(object sender, EventArgs e) { comboBox4.Visible = false; comboBox5.Visible = false; comboBox6.Visible = false; comboB...
asked by 14.03.2014 / 22:21
2
answers

Convert Date dd / mm / yyyy to ISO 8601 Format (yyyy-mm-dd)

I have a field called maskedTextBox2 in the C # Windows Form, which contains a date mask in dd/mm/aaaa format. How can I do to convert this string into aaaa-mm-dd format to save to MySQL database, which uses dates in ISO 8...
asked by 30.03.2014 / 21:59
2
answers

Calling generic methods in C #

I built a generic method that suits me well, but I'm having difficulty calling this method. public List<T> CriaLista<T>(params T[] pars) { List<T> lista = new List<T>(); foreach (T elem in par...
asked by 23.06.2017 / 02:56
1
answer

Store part of a string in a variable

I get the string below, through a response.StreamReader : 240144|000|5511946724649|2015-08-30 21:45:51|2015-08-30 21:46:02|1| How do I proceed to store the contents between the pipes each in a variable?     
asked by 02.09.2015 / 04:44
2
answers

Quantity of a given character contained in a StringBuilder

I have a StringBuilder with these values: 12 ********** 3 * 4 *. Is there a simple way to return the number of asterisks without having to load a string on top of my StringBuilder? I'm using C # with Net Framework 3.5     
asked by 17.07.2014 / 19:12
1
answer

MVC - Create a typed model being a generic list

I would like to create a typed Model with it being a list of type T . Using: ASP.NET MVC 5 Razor For example: My model in cshtml will look like this: @model List<T> @foreach (var item in Model) { <h1>@item.nam...
asked by 23.06.2017 / 03:03
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