Questions tagged as 'c#'

2
answers

How do I update an item from a generic list?

I'm trying to change the name and email of a certain item from the list below, but found no way other than to remove the item from the list and add it upgraded again. Is there another way to update? class Program { static void Main(string[...
asked by 16.09.2015 / 20:48
3
answers

"Clean" way to modify the "visible" attribute of a PictureBox

I have 5 background images for my application that will be visible to the user's taste. What is the simplest (clean code) way to make the user choose? private void radioButton1_CheckedChanged(object sender, EventArgs e) { pictu...
asked by 29.05.2014 / 01:47
2
answers

How to fire multiple exceptions?

foreach (Foo el in arr) { // ... Validate(el); // ... } In the example code, when foreach is executed, an exception can be raised from the Validate function that will be handled in who called the method that contains...
asked by 13.09.2017 / 16:48
5
answers

Regex take from one point to another within a text

I have the following text: From: .... blabla bla Message: blablabalab //linha em branco From: .... blabla bla Message: blablabalab //linha em Branco From: .... blabla bla Message: blablabalab How do I make my regex pick up where From...
asked by 16.03.2015 / 13:08
4
answers

"Filter" equal records in a list by adding their quantitative

namespace ConsoleApplication10 { class Program { static void Main(string[] args) { List<Teste> lstTeste = new List<Teste> { new Teste {Codigo = 1, Quantidade = 10},...
asked by 22.09.2015 / 22:22
2
answers

XML serialization - NFC e-element [closed]

I'm trying to serialize an XML from the electronic invoice, but when I got to the id element where it is an Array object I packed myself because I get the error "Object reference not set to an instance of an object." Based on an XML from an NFe...
asked by 22.09.2016 / 01:22
2
answers

Yield return within a using

Consider the following situation: public class MeuRecursoBemCaro : IDisposable { public T FazerOperacaoBemCara(T item) { //Do operação } public void Dispose() { //Dispose logi...
asked by 22.05.2014 / 20:43
2
answers

Alternatives to developing VBA in Office

At work I have a large code base written in VBA (about 13 active projects) for both Access and Excel applications. I have been trying to refactor some things, but several factors are making my work difficult, like: The IDE that comes with...
asked by 17.10.2014 / 15:26
1
answer

How to read folder and subfolder files?

I have a function to read the files from the folder, and it is not working. I need a functional function that reads files from folders and subfolders. Here is the code: FolderBrowserDialog fbd = new FolderBrowserDialog(); DialogRes...
asked by 05.09.2014 / 19:31
2
answers

Remove an item from a List

Well, I have a method that I query on my bank and compare with a List<Carros> . My intention is, for each item that contains both in my query, and in my List<Carros> , I remove the item from my List<Carros> ....
asked by 08.05.2015 / 16:33