Questions tagged as 'c#'

2
answers

Why does not return work? [closed]

I have a problem with return not working at all. For now I'm just printing to the console, so I'm replacing return with Console.WriteLine() , but I did not always want to have to do that. Here is an example that retu...
asked by 01.08.2017 / 00:54
1
answer

Can not create an ActiveX control instance because the current thread is not in an STA

I'm trying to access a website through the WebBrowser and this morning suddenly the following error appeared    You can not create an instance of the ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' because the current thread is not in...
asked by 31.07.2017 / 17:00
2
answers

null object when deserializing Json

I make a request to an API, which returns me data in the form of JSON. Example: { "id": 8452, "creator_user_id": { "id": 46342, "name": "ADM. Suporte Comercial", "email": "*******@gmail.com", "has_pic": true, "pic_hash": "296e6514a7d0bf854f...
asked by 11.08.2017 / 21:08
2
answers

When to use optional parameters above overloading and vice versa?

An optional parameter in C # is declared as follows (see parameter y ): public void DoFoo(String x, String y = "") { ... } In many cases this feature can be overridden by overload method signature public void DoFoo(String x) { ....
asked by 04.10.2017 / 21:48
1
answer

Check if multiple columns contain a value?

Query: query = query.Where(t => t.campo1.Contains(filter) || t.campo2.Contains(filter) || ......); I would like to know if there is a way that I do not need to keep all fields in the table, do something more general to se...
asked by 27.09.2017 / 14:13
2
answers

How to display the total rows of a table in a label

I do not know how to pull the total rows of a table, code: public string Eventos { get; set; } SqlCommand comando = new SqlCommand("SELECT count(*) FROM Active", conn); SqlDataReader leitor = comando.ExecuteReader(); while (leitor.Read()) {...
asked by 26.09.2017 / 18:08
3
answers

TempData ["Message"] error in the runtime saying that the object is null

I recently started with ASP.NET MVC, and as you can see I'm playing in the if statement, else the tempData[] and the one that happens is a following, every time I click inside the else in "View in Page Inspector" it gives me an error in t...
asked by 02.09.2014 / 17:09
1
answer

Model-relational in firebird with C #

Developing a small C # project with Visual Studio, firebird and ibexpert. With the tables NOT RELATIONSHIP I run everything right. But I need to relate CLIENTE 1: N to BONUS E SAIDA . I am not able to develop the following re...
asked by 23.09.2014 / 05:02
2
answers

Fill a DataTable from a list of a complex type

I want to create a method that receives a list of a complex type any List<T> and returns a DataTable with all the data. In my code I got here. protected virtual DataTable buildDataTableFromComplexTypeList<T> ( string tableNa...
asked by 17.02.2017 / 22:43
1
answer

What is the HttpHandler and HttpModule of ASP.NET?

What is the HttpHandler and HttpModule of ASP.NET? How do they work? How to use?
asked by 26.01.2017 / 16:26