Tag: vb.net

54 votes
5 answers
1.2K views
Which is generally best to use -- StringComparison.OrdinalIgnoreCase or StringComparison.InvariantCultureIgnoreCase?

I have some code like this: If key.Equals("search", StringComparison.OrdinalIgnoreCase) Then DoSomething(

avatar
User demo
0 1 0 9
asked 07 September, 2021
55 votes
6 answers
376 views
Is there a VB.NET equivalent for C#'s '??' operator?

Is there a VB.NET equivalent for C#'s ?? operator?

avatar
Winford
0 1 0 9
asked 07 September, 2021
61 votes
15 answers
2K views
Setting Objects to Null/Nothing after use in .NET

Should you set all the objects to null (Nothing in VB.NET) once you have finished with them? I understand th

avatar
Thurman
0 1 0 9
asked 07 September, 2021
57 votes
15 answers
3K views
Is there a way to navigate to real implementation of method behind an interface?

In Visual Studio, when you right-click a method call, you go to the implementation of that method inside a cla

avatar
Thurman
0 1 0 9
asked 07 September, 2021
52 votes
6 answers
337 views
Difference between Lookup() and Dictionary(Of list())

I'm trying to wrap my head around which data structures are the most efficient and when / where to use wh

avatar
Jefferey
0 1 0 9
asked 07 September, 2021
54 votes
15 answers
377 views
Best way in asp.net to force https for an entire site?

About 6 months ago I rolled out a site where every request needed to be over https. The only way at the time

avatar
Forrest
0 1 0 9
asked 07 September, 2021
69 votes
5 answers
2.7K views
.NET Global exception handler in console application

Question: I want to define a global exception handler for unhandled exceptions in my console application. In a

avatar
Clarice
0 1 0 9
asked 07 September, 2021
56 votes
24 answers
1.8K views
Get the generated SQL statement from a SqlCommand object?

I have the following code: Using cmd As SqlCommand = Connection.CreateCommand cmd.CommandText = "UPDATE s

avatar
Shanita
0 1 0 9
asked 07 September, 2021
68 votes
10 answers
1.3K views
Is it possible to write to the console in colour in .NET?

Writing a small command line tool, it would be nice to output in different colours. Is this possible?

avatar
Scot
0 1 0 9
asked 07 September, 2021
52 votes
8 answers
621 views
HTML encoding issues - "Â" character showing up instead of " "

I've got a legacy app just starting to misbehave, for whatever reason I'm not sure. It generates a

avatar
Sydney
0 1 0 9
asked 07 September, 2021
56 votes
11 answers
821 views
What is the difference between And and AndAlso in VB.NET?

In VB.NET, what is the difference between And and AndAlso? Which should I use?

avatar
Brianne
0 1 0 9
asked 07 September, 2021
56 votes
9 answers
1.3K views
How do I get my C# program to sleep for 50 msec?

How do I get my C# program to sleep for 50 milliseconds? This might seem an easy question, but I'm havin

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
50 votes
22 answers
2K views
How do I get a human-readable file size in bytes abbreviation using .NET?

How do I get a human-readable file size in bytes abbreviation using .NET? Example: Take input 7,326,629 and d

avatar
Patsy
0 1 0 9
asked 07 September, 2021
67 votes
7 answers
831 views
What is the purpose of a stack? Why do we need it?

So I am learning MSIL right now to learn to debug my C# .NET applications. I've always wondered: what is

avatar
Rudolf
0 1 0 9
asked 07 September, 2021
58 votes
3 answers
874 views
Visual Studio jump to next error shortcut?

When a compile fails in VB.NET in Visual Studio 2008, an Error List pops up at the bottom of the screen. To ju

avatar
Adolfo
0 1 0 9
asked 07 September, 2021
66 votes
30 answers
518 views
Difference in months between two dates

How to calculate the difference in months between two dates in C#? Is there is equivalent of VB's DateDi

avatar
Dorinda
0 1 0 9
asked 07 September, 2021
49 votes
26 answers
1.4K views
What is the best workaround for the WCF client `using` block issue?

I like instantiating my WCF service clients within a using block as it's pretty much the standard way to

avatar
Bryan
0 1 0 9
asked 07 September, 2021
62 votes
21 answers
2.6K views
Why is there no ForEach extension method on IEnumerable?

Inspired by another question asking about the missing Zip function: Why is there no ForEach extension method o

avatar
Ali
0 1 0 9
asked 07 September, 2021
58 votes
4 answers
1.5K views
Is there a conditional ternary operator in VB.NET?

In Perl (and other languages) a conditional ternary operator can be expressed like this: my $foo = $bar == $b

avatar
Lynette
0 1 0 9
asked 07 September, 2021
59 votes
12 answers
1.9K views
How do you get a string from a MemoryStream?

If I am given a MemoryStream that I know has been populated with a String, how do I get a String back out?

avatar
Margo
0 1 0 9
asked 07 September, 2021