Questions tagged as '.net'

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

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

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

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
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
2
answers

Data search with Entity Framework

I have a project in Asp.Net MVC where I need to work with a large volume of data. To get them from the Database (Microsoft SQL Server) using Entity Framework 4 I basically know three ways: 1st form: var resultado = from p in db.Pessoa...
asked by 17.02.2016 / 12:34
2
answers

Removing character double quotes "

I have a code that reads a CSV and saves the information in the database, however I ended up getting a "different" CSV from what I am used to reading. This CSV comes with double quotation marks in the information. Ex: "0", "20151109", "171729...
asked by 21.03.2016 / 19:24
2
answers

Which object performs best? SqlDataSource or DataTable?

In terms of performance, speed, or security, what is the best object to use as a DataSource ? Example, I am creating a DataSource , to popular a GridView : By SqlDataSource : this.sqlDataSource1.ConnectionName = "...
asked by 27.07.2016 / 15:35
2
answers

View Model should have related classes?

I have three entities: Manager , PersonalData and Address . A Manager has a PersonalData and a PersonalData has a Address . My question is when creating ViewModels , I would have to have a proper...
asked by 12.07.2016 / 23:15