Questions tagged as '.net'

2
answers

Difference cast using "as" and "type cast"

A question about casting in C #, I see in many sources using cast in the following ways. What's the difference between one and the other when using one way or another? public interface InterfaceTeste { int Id { get; set; } } public...
asked by 23.03.2018 / 20:28
2
answers

What is the purpose of the GetHashCode () method?

I am using Resharper to automate overwriting of the Equals method and the == operator. One of the methods the tool overwritten is GetHashCode : public override int GetHashCode() { unchecked { return (Id.GetH...
asked by 20.03.2017 / 14:14
4
answers

Dynamically check which attributes of a Model have changed?

I'm developing an ASP.NET MVC 4 application and need to save the log of every change made to a Model object. Is there any native method or implementation already known that does this? Example: public class Pessoa { public int? Id { ge...
asked by 14.08.2014 / 20:14
4
answers

How do I execute a method at the end of each method of my C #

You have a parent class and a daughter, and would like to execute a particular method, such as an event, always at the end of each method call for the child classes. How can I do it?     
asked by 23.06.2014 / 13:40
2
answers

How to select fields in a query in lambda expression?

Through% of LINQ% I can select which fields will be displayed in the query, for example: var subCategorias = from s in db.SubCategoria join c in db.CategoriaProduto on s.id_categoria equals c.id_cat...
asked by 09.06.2016 / 02:47
2
answers

Remove special characters and spaces from a string?

I have a problem, in an app I'm picking up contacts from the phonebook, however I want to make a treatment in the contact numbers that can come like this: (99) 9999-9999 9999-9999 9999 9999 and among other things, the only treatment I did w...
asked by 15.11.2015 / 16:53
2
answers

How does "new" and "virtual" work in C #?

Can you explain to me how they work in C #? When I create a parent class and it has a teste() method and I want to rewrite this method in the child class, I need to use virtual and new ? If I create: class Veiculo {...
asked by 06.09.2016 / 00:13
2
answers

Access internal code structures C # / .NET

Is it possible to access the inner structures of a C # core code or .NET System.Core libraries? For example, how is the First() method implemented? Alerta alerta = query.First(); I wanted to see how this is done behind the sce...
asked by 16.06.2016 / 19:42
1
answer

How to get information from the computer with C #?

As the information on the computer where the C # application is running, such as computer name, IP, firewall status, whether antivirus is installed, whether antivirus is enabled, etc.     
asked by 23.03.2015 / 13:07
3
answers

How to reuse event code?

I have events that when pressing different keys perform some actions but I need to use this thing in more than one form , how can I do this? I found the issue of inheritance in C # Windows Forms a little complicated. An example that I use...
asked by 16.07.2016 / 22:04