Questions tagged as 'c#'

4
answers

Good practices in using DB connections via Entity Framework

When defining the context class in the Entity Framework (example): public class Context : DbContext { public DbSet<Usuario> Usuarios { get; set; } public DbSet<Categoria> Categorias { get; set; } } And used in DAO classe...
asked by 25.02.2014 / 17:12
2
answers

How do I convert LINQ to SQL for MySQL?

I'm trying to remove the use of SQL statements from within the system (to make it flexible on the database that will be used), I use statements Insert , Update and Delete via stored procedure (for performance and for flexibi...
asked by 28.01.2015 / 14:57
5
answers

Schedule execution process in C #

I have an application that will be running 24h / day the 7days / week, that is, it will always be running. I need at a specific time, every day a method of this application is called.     
asked by 17.08.2015 / 15:40
2
answers

How to populate a DropDownList from another DropDownList

I need to know how to populate a DropDownList from another DropDownList. Example: I have a DropDownList named Project that takes the information from my DB. When I select for example "Project 1" I need in my second DropDownList to load all Sub P...
asked by 23.07.2015 / 13:54
2
answers

Returning a list using select new with LINQ

I can do this: var filial = (from f in base.EntityContext.vw_filial select f).ToList<vw_filial>(); But, I want to do something like this: var filial = (from f in base.EntityContext.vw_filial select new {...
asked by 18.12.2014 / 12:47
2
answers

Convert string Base16 (Hexadecimal) to Base10 (Decimal)

I have the following string "615769EF" , which is in hex. How to convert it to base10 and that the result is the string "01633118703" ?     
asked by 16.06.2015 / 15:07
2
answers

How to tell if the file is being used by another process before attempting to read

My system does N jobs over a list of files, eventually I get this exception:    System.IO.IOException: Process can not access file   'C: \ XXXXXX \ xxxx.xxx' because it is being used by another process. The code that throws the exception...
asked by 23.05.2015 / 03:29
2
answers

Values of an Enum can only be integers?

Studying C #, I came across a situation, I want to get a value ( string ) from the console. And then compares it with the value of an enum . For example: [Serializable] public enum Command { Exit = "/exit", SendMessage...
asked by 26.06.2015 / 17:06
1
answer

How to round decimals up to get an integer in C #?

I have the following account: var NumeroDePaginas = NumeroDeItens / 32; When I use Math.Round it rounds both up and down. But whenever there is any decimal value I want to return an integer value rounded up. Example: If NumeroD...
asked by 02.09.2014 / 20:00
2
answers

How to get multiple groups in a Regex?

public string site = "http://www.tibia.com/community/?subtopic=worlds&world=Aurera"; private Regex nomedochar = new Regex("subtopic=characters&name=(?<player>.*?)\" >"); public string nomedochar2 = ""; public Thre...
asked by 20.04.2014 / 07:33