Questions tagged as '.net'

2
answers

Return with 2 Values C # [duplicate]

I want to give return of two values in C #. My code is so currently, just returning imagePath , but I want to return imagePath and normalPath at the same time. string imagePath = "~/Images/QrCode.jpg"; string norma...
asked by 18.04.2018 / 18:36
3
answers

Remove non-numeric characters from a string

Example: I have the following string    "M1245D454" I need only leave the numbers on it. M and D, are examples, I want to remove any non-numeric character. Is there any function in C # or VB.NET for this?     
asked by 14.04.2016 / 21:35
2
answers

Encapsulation confusing in C #

I was creating a template that in its construtor I set the Nome attribute. however, this attribute will only have get , as opposed to java oc # has the resource for getters and setters I thought I would simply d...
asked by 14.03.2014 / 20:50
3
answers

What is the best way to check the existence of a record in the database via the application?

Today I use a method that sends a COUNT with the record Id as a parameter to the database. Is there a better, perhaps more performative way to do this?     
asked by 27.02.2015 / 14:38
2
answers

How to cut a string?

Example: nome = "Josénildo da Silva Ramos do Carmo"; Cut to have up to X characters, thus: nome = "Josénildo da Silva "; In the case I cut it to 20 characters. How do I do this in C #? I only know in C (which is vector). In C # I...
asked by 14.07.2015 / 01:35
4
answers

Why not always use Optimize Code?

In Visual Studio there is the Optimize Code that has the function of creating optimizations performed by the compiler to make your output file smaller, faster and more efficient. Why can not I always use this option in my projects?    ...
asked by 31.05.2016 / 20:24
3
answers

Add multiple items to a list

Is there any way to add multiple Int to a list<int> at a single time? Type List<Int32> ContasNegativas = new List<Int32>(); ContasNegativas.AddRange(30301, 30302, 30303, 30304, 30305, 30306, 30341, 30342, 30...
asked by 30.11.2015 / 19:57
3
answers

Read a console line in C #

   CS1503 Argument 1: Can not convert from "method group" to "object" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Teste { class Program { stati...
asked by 08.03.2018 / 04:47
2
answers

Comparing only the DateTime field date in C #

I need to compare only the date of two fields DateTime . DateTime aux = new DateTime(2016, 09, 02, 10, 0, 0); if (aux.Equals(DateTime.Now)) { //Alguma ação... } In the code above, I need to enter if when the date (09/02/20...
asked by 02.09.2016 / 15:38
3
answers

Difference between syntax of properties in C # [duplicate]

What I researched, if I did: public int numero { get; set; } is the same as: private int numero; public int Numero { get{ return numero; } set{ numero = value; } } But in the first code snippet every...
asked by 20.07.2017 / 23:29