Questions tagged as 'c#'

1
answer

How to implement an abstract method with a generic class in C #

I'm creating a functional Factory where I define what kind of output it is and what the required implementation methods are. With this implementation, when I try to use the object obj within the function that does every factory process...
asked by 29.08.2018 / 19:26
2
answers

Vector ascending order c # [closed]

How to put odd numbers in ascending order? int c = 0; int[] numeros = { 10, 5, 20, 60, 1, 5, 8, 30, 11, 20, 25, 30, 50 }; Console.Write("Números pares"); foreach (int num in numeros) { if (num % 2 == 0) { Console.Write(num + ",...
asked by 04.09.2017 / 09:20
1
answer

Compiler error due to lack of constructor

I have the following classes: class Disciplina : public class Disciplina { public int Id { get; set; } public string Nome { get; set; } } interface IGenericaDAO : public interface IGenericaDAO<T> { bool Ad...
asked by 23.05.2017 / 15:17
1
answer

Error performing LINQ query with equals at where closure

When you run the query below: public ActionResult GridViewPartial() { if (Session["cod_cli"] != null) { int cod_cli = Convert.ToInt32(Session["cod_cli"]); //var model = db.DadosTecnicos;...
asked by 31.07.2017 / 14:02
2
answers

Methods with more than one Generic [closed]

There is a possibility to create a method using more than one type of generic , more or less like this. public static TResult ToEntityForType<TResult>(this DataRow row, TType type) where TType : Type { TResult entity = A...
asked by 15.06.2017 / 15:11
1
answer

Doubt with SQL injection

I have an internal method that is called based on another query, it is this way down. I would like to know if this would be a "string.Format" error, if it would be possible to send a SQL injection? public BuscaProdutosDermaClubeEntity ProdutoD...
asked by 13.06.2017 / 05:00
3
answers

Search for word variations

I have a sentence that I need to check if it meets a rule but there may be variation in writing (accentuation, more or less spaces, ...) Example: string fraseProcurada = "Cadastro de Usuários - SP"; if (fraseRecebida.Contains(fraseProcurad...
asked by 04.04.2018 / 15:55
1
answer

How to validate ComboBox?

I have a Form of register that has some fields TextBox and ComboBox , I want my code to allow the user to register only when all fields are filled, but only validating the TextBox thus allowing the registration to be c...
asked by 15.04.2018 / 02:09
2
answers

Convert date 20171130 to 30/11/2017 format in string

I have this date field '20171130' saved in the database, and I need to convert to string formatting "30/11/2017" in my application, how to do this type of conversion? .     
asked by 01.12.2017 / 17:55
1
answer

Close a MySql connection without commit or rollback in C # asp.net

I would like to know what happens in the following scenario: In a program asp.net with c # was opened MySqlConnection , then started a MySqlTransaction , was done insert in the open transaction, however, instead of givi...
asked by 25.02.2014 / 17:51