Tag: c

61 votes
11 answers
2K views
What is the C# version of VB.net's InputDialog?

What is the C# version of VB.net's InputBox?

avatar
Omar
0 1 0 9
asked 07 September, 2021
57 votes
5 answers
2.4K views
How to write Unicode characters to the console?

I was wondering if it was possible, in a console application, to write characters like ℃ using .NET. When I

avatar
Basil
0 1 0 9
asked 07 September, 2021
54 votes
7 answers
3.1K views
How to loop through all the properties of a class?

I have a class. Public Class Foo Private _Name As String Public Property Name() As String Get

avatar
Winford
0 1 0 9
asked 07 September, 2021
63 votes
12 answers
3K views
ObservableCollection Doesn't support AddRange method, so I get notified for each item added, besides what about INotifyCollectionChanging?

I want to be able to add a range and get updated for the entire bulk. I also want to be able to cancel the ac

avatar
Charis
0 1 0 9
asked 07 September, 2021
58 votes
7 answers
1.6K views
What exceptions should be thrown for invalid or unexpected parameters in .NET?

What types of exceptions should be thrown for invalid or unexpected parameters in .NET? When would I choose on

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
56 votes
12 answers
790 views
Check if a string contains an element from a list (of strings)

For the following block of code: For I = 0 To listOfStrings.Count - 1 If myString.Contains(lstOfStrings.I

avatar
Dorinda
0 1 0 9
asked 07 September, 2021
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
382 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
339 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
381 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
624 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
824 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
836 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