Questions tagged as 'c#'

1
answer

Selecting all Rows in a DataGridView

I would like to know how I can select all Rows of a DataGridView . Code that I have: DataGridView.Rows[0].Cells[0].Value.ToString();     
asked by 16.10.2016 / 17:18
1
answer

How does the use of other numerical bases in C # work?

When I was learning the basics of C # variables, I learned that integer numeric statements ( Int32 ) used the numeric base 10, which is what we use most commonly in our day to day. A little later, I discovered that I could use hexadecimal...
asked by 28.07.2017 / 16:47
1
answer

Why does calling a simple method in a class give a reference error?

I'm starting to study C # and I get the following error:    CODE: CS0120 DESCRIPTION: An object reference is required for   the non-static field, method, or property   'Program.SomarNumeroes (int, int)' CODE: CS0120 DESCRIPTION:   An objec...
asked by 24.08.2016 / 21:16
1
answer

How to add image on second page with setAbsolutePosition iTextSharp C #?

I wonder if you can use setAbsolutePosition to add an image on the second page of the document built in iTextSharp PDF. if possible, how?     
asked by 08.09.2016 / 16:23
1
answer

When should I instantiate a class?

I am doubtful when it is the best time to call instantiate a classe . Should I do this in the beginning, before the constructor, in the constructor or at the time we are going to make use of any method? In the example below I creat...
asked by 24.07.2016 / 15:34
1
answer

Can you have some error in foreach execution in this method?

Can I run the following code in error? protected void ImprimeValores(Ilist<int> values) { if (values.Count > 0 && values != null) { foreach(int v in values) Console.WriteLine(string.Con...
asked by 22.05.2016 / 20:14
1
answer

C # Convert object to an unknown list of objects

I have an issue here. I have an object received by parameter. It can be a single object or list of objects (List). How can I convert the object to a List object WITHOUT RECEIVING THE TYPE by parameter? I do not want the signed method with....
asked by 06.06.2016 / 16:57
3
answers

Repeating code in the same method

I have a method that generates some information. As I was in a hurry to deliver, I did and I sent. Well, it turns out, that looking at the code more carefully, I realized how crappy it is. It was made to meet a specification and as it was change...
asked by 25.05.2016 / 18:34
1
answer

NullReferenceException when calling function

I'm creating some unit tests for a class library that does manipulations in a database. The method being tested is this: public object ExecuteNoQueryOperation ( string spOrSqlInstructions, CommandType commandType = CommandType.StoredProcedu...
asked by 04.06.2016 / 20:01
1
answer

What is the advantage of using Tag Helpers in ASP.Net Core?

I'm studying ASP.NET Core and came across the tag helpers when I generated the scaffold of a view . I found the new syntax interesting, the code is more readable on some points, however, adding another DLL to all views that used tag help...
asked by 30.12.2015 / 13:25