Questions tagged as 'c#'

4
answers

How to call a "Stored Procedure"?

How to call a procedure in ASP.NET C #? Here's my simple procedure: CREATE PROCEDURE GetAdmin ( @email VARCHAR(50), @password VARCHAR (50) ) AS BEGIN SET NOCOUNT ON; SELECT * FROM Admin WHERE Email = @...
asked by 13.02.2014 / 18:44
4
answers

How to replace {vars} in a string?

I have a string string str = "Bem vindo {Usuario}. Agora são: {Horas}"; I want to replace {Usuario} with a name and {Horas} with the current time, how can I do this?     
asked by 19.12.2013 / 03:16
2
answers

Do I need to assign null to a variable after use?

Is there a need to assign null to the object after its use? In the example below right after using the list I have a method that takes a long time to run. Do I need to assign null to the list to optimize the application? priva...
asked by 20.01.2017 / 17:35
2
answers

Display zero on the left using the ToString method

I have more or less the following code implemented in C #: using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Teste { public class Program { public static void Ma...
asked by 31.03.2017 / 07:52
3
answers

How to get information from a SSL certificate via C #?

How to get information (expiration date for example) from an SSL certificate via C #?     
asked by 25.03.2015 / 21:14
1
answer

What does the "OR" operator do in an Enum?

What does the logical operator | (or) do in that Enum? public enum Status { Running = 1, Inactive = 2, Error = Inactive | Running }     
asked by 10.07.2014 / 21:19
2
answers

How to test private methods in C #?

How to test private methods using Microsoft.VisualStudio.TestTools.UnitTesting and Moq My test class looks like this: [TestClass] public class ClasseDeTeste { private MinhaClasseComMetodosPrivados _minhaClasseComMetodosPrivados;...
asked by 05.06.2017 / 22:47
2
answers

Error using the File.Delete method inside the Controller

I'm having problems with my controller the moment I start a file exclusion routine. I'm using the File.Delete() method, but it just does not recognize and returns the following warning:    Can not choose method from method gr...
asked by 14.02.2014 / 13:19
3
answers

Why is it possible to define two or more methods with the same name in the same class in C #?

I'm starting my studies in C # with ASP.NET MVC today. I'm still adapting with some things I'm not used to seeing, because I know languages like PHP, Python and JavaScript. I noticed that in a code that has already come ready, when starting a...
asked by 28.05.2016 / 19:05
2
answers

What is the way to truncate a string in Csharp?

I have a scenario where I have set the maximum size of a field. I want to cut this value to the limit. I'm doing this through Substring , but it returns an error when I have a smaller-sized character. Example: int limite = 20; string...
asked by 07.12.2017 / 16:25