5,931 questions
0
votes
0
answers
19
views
VB.NET 3.5 OdbcDataAdapter.Fill causes OverflowException after moving from Windows 10 x86 to Windows 11 x64
I’m maintaining a legacy VB.NET 3.5 Windows Forms app that worked perfectly on Windows 10 32-bit using MySQL ODBC Connector 5.1/5.3.
Recently, we migrated to a Windows 11 64-bit machine. Without ...
1
vote
0
answers
54
views
IEventAggregator alternative in .NET Framework 3.5
The snippet of newer version of my code looks like this
public MainWindowViewModel()
{
ProcessedLotIDList = new List<string>();
_eventAggregator = IoC.Get<IEventAggregator>();
...
1126
votes
19
answers
1.2m
views
Creating a byte array from a stream
What is the prefered method for creating a byte array from an input stream?
Here is my current solution with .NET 3.5.
Stream s;
byte[] b;
using (BinaryReader br = new BinaryReader(s))
{
b = ...
1154
votes
22
answers
1.2m
views
LINQ query on a DataTable
I'm trying to perform a LINQ query on a DataTable object and bizarrely I am finding that performing such queries on DataTables is not straightforward. For example:
var results = from myRow in ...
754
votes
12
answers
681k
views
Use LINQ to get items in one List<>, that are not in another List<>
I would assume there's a simple LINQ query to do this, I'm just not exactly sure how.
Given this piece of code:
class Program
{
static void Main(string[] args)
{
List<Person> ...
389
votes
35
answers
406k
views
Could not find default endpoint element
I've added a proxy to a webservice to a VS2008/.NET 3.5 solution. When constructing the client .NET throws this error:
Could not find default endpoint element that references contract '...
697
votes
12
answers
625k
views
Concat all strings inside a List<string> using LINQ
Is there any easy LINQ expression to concatenate my entire List<string> collection items to a single string with a delimiter character?
What if the collection is of custom objects instead of ...
751
votes
11
answers
287k
views
Which method performs better: .Any() vs .Count() > 0?
In the System.Linq namespace, we can now extend our IEnumerable's to have the Any() and Count() extension methods.
I was told recently that if I want to check that a collection contains one or more ...
451
votes
16
answers
289k
views
How to bind inverse boolean properties in WPF?
What I have is an object that has an IsReadOnly property. If this property is true, I would like to set the IsEnabled property on a Button, ( for example ), to false.
I would like to believe that I ...
498
votes
13
answers
242k
views
What is the difference between IQueryable<T> and IEnumerable<T>?
What is the difference between IQueryable<T> and IEnumerable<T>?
See also What's the difference between IQueryable and IEnumerable that overlaps with this question.
366
votes
21
answers
244k
views
How to parse a string into a nullable int
I'm wanting to parse a string into a nullable int in C#. ie. I want to get back either the int value of the string or null if it can't be parsed.
I was kind of hoping that this would work
int? val =...
493
votes
13
answers
476k
views
WCF - How to Increase Message Size Quota
I have a WCF Service which returns 1000 records from database to the client. I have an ASP.NET WCF client (I have added service reference in asp.net web application project to consume WCF).
I get ...
309
votes
17
answers
429k
views
How to read an entire file to a string using C#?
What is the quickest way to read a text file into a string variable?
I understand it can be done in several ways, such as read individual bytes and then convert those to string. I was looking for a ...
258
votes
10
answers
169k
views
Why Response.Redirect causes System.Threading.ThreadAbortException?
When I use Response.Redirect(...) to redirect my form to a new page I get the error:
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
An ...
225
votes
10
answers
329k
views
Creating a DateTime in a specific Time Zone in c#
I'm trying to create a unit test to test the case for when the timezone changes on a machine because it has been incorrectly set and then corrected.
In the test I need to be able to create DateTime ...