Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
111 views

A while ago I created a small Use-ClassAccessors script and uploaded that to the PowerShell Gallery. Now I am creating another script that has a dependency on the Use-ClassAccessors script. Is there ...
iRon's user avatar
  • 24.4k
2 votes
1 answer
586 views

I found the following code: using (var requestMessage = new HttpRequestMessage(HttpMethod.Delete, endpoint)) { ... HttpResponseMessage response = await _client.SendAsync(requestMessage); .....
David Klempfner's user avatar
1 vote
0 answers
47 views

A file within a custom VS project template is getting altered automatically by VS when the template is used to create a project. Code in the template zip file: using Enterprise.Utilities.ServiceBase....
MajorMajorMajor's user avatar
0 votes
1 answer
95 views

is it necessary to use using Dispose the connection, open and close connection if using DbContext dapper in MS access database on vb.net. This is my first time using dapper, please guide me so that ...
roy's user avatar
  • 729
-1 votes
1 answer
115 views

class A { TypeX PropertyX; void SomeMethod() { using (DisposableType y = new DisposableType()) { PropertyX = y.GetX(); } } } What happens to PropertyX when Y is being ...
Piglet's user avatar
  • 29.3k
0 votes
1 answer
52 views

I have using statement to close the OleDbConnection and then I'm working with the reader. I'm wondering if I have to close the reader at the end or I can rely on the using statement to close it. I've ...
zaraboy's user avatar
  • 21
-1 votes
3 answers
273 views

using (StreamReader outFile = new StreamReader(outputFile.OpenRead())) { StreamReader resFile = new StreamReader(resultFile.OpenRead()) { //Some Codes } } Why does the above ...
Prakash sekar's user avatar
0 votes
2 answers
194 views

I'm not talking about references to assemblies, rather the using statement within the code. For example what is the difference between this: using (DataReader dr = .... ) { ...stuff involving data ...
Mark Roworth's user avatar
1 vote
1 answer
653 views

Background: I am creating an avaloniaUI project and in it I have a json config with a class that serializes and deserializes it on initialization and editing. If the file can't be found on ...
Artemis Venatrix's user avatar
1 vote
1 answer
426 views

Consider a disposable with side effects in the constructor: public class MyDisposable : IDisposable { public MyDisposable() { // Some side effects ... } public void ...
Linus's user avatar
  • 3,630
0 votes
0 answers
286 views

I have an in memory static repository which is used both for writing into it and reading from it. When writing (updating) that repository, I would like to make it completely exclusively available for ...
Guy E's user avatar
  • 1,957
0 votes
0 answers
33 views

I have made a disposable class UnitOfWOrk which will also acts as an optional parameter, I have provided an exampel below. public async Task CallPersistItemPassUoW() { using (var unitOfWork = new ...
WilliamG's user avatar
  • 137
0 votes
1 answer
410 views

using PuppeteerSharp; using System; using System.Threading.Tasks; namespace Video_Handler { public class VideoHost { private static bool Is_HTTPS_URL(string url) { ...
Codelyok 13's user avatar
5 votes
2 answers
2k views

Consider the following code: switch ("") { case "": using var s = new MemoryStream(); break; } The above code won't compile with this ...
Luke Vo's user avatar
  • 21.6k
3 votes
1 answer
344 views

So if I get a connection pool, then something unexpected happens and the error will be thrown, do I need to additionally release a connection? What happens with the MySQL connection pool once the ...
Iqaru's user avatar
  • 107
0 votes
1 answer
1k views

I am working on a .Net console app with c# and I have just added the Newtonsoft.Json using statement but VS code points it out as an error The type or namespace name 'Newtonsoft' could not be found (...
Sophie Obomighie's user avatar
0 votes
1 answer
238 views

I got stuck in the weeds of how IDisposable and the GarbageCollector work. Suppose you have an IDisposable object, which doesn't actually have an resources that it's holding onto (but the Dispose() ...
Brondahl's user avatar
  • 8,743
0 votes
1 answer
813 views

I have a question about C# using statement. According to the docs, it is a best practice to both declare and initialize the resource (for instance, a SqlConnection object) inside the using statement. ...
LioH's user avatar
  • 197
2 votes
2 answers
142 views

I know this would be a correct way to use a StreamWriter: using (StreamWriter sw = new StreamWriter(hreq.GetRequestStream())) sw.Write(jsonPostData); But what about this? Is this also valid or to ...
tolsen64's user avatar
  • 1,009
0 votes
0 answers
96 views

In my project I would like to know the references of a specific type within my C# project. For example I have the class EntityA. I have two other classes ProcessA and ProcessB. ProcessA and ProcessB ...
Jelle van Lith's user avatar
10 votes
3 answers
2k views

I was refactoring some the other day, I bumped into something like that: public async Task<Result> Handle(CancelInitiatedCashoutCommand command, CancellationToken cancellationToken) { using ...
Natalie Perret's user avatar
0 votes
0 answers
66 views

The site I maintain was built with ASP Webforms. I was not involved in building it. Since upgrading the server where it is hosted we started seeing a lot of the following error: "Timeout expired. The ...
cormacio100's user avatar
-3 votes
2 answers
288 views

I'm writing a class library which includes socket operations. I don't want to rely on the consumer to dispose resources after finishing or when an exception is thrown. Normally I would use the "using"...
Josh's user avatar
  • 307
0 votes
2 answers
674 views

I need to read one file and write processed data into one or optionally two files. How to organize the Using statements in this case? Will something like this work? if (condition) using (var sw2 ...
yaugenka's user avatar
  • 2,881
2 votes
1 answer
50 views

using declarations were just introduced in C# 8.0 but they don't behave the same as using blocks, or so i think. The following nested using block works fine: using (var resource = Assembly....
Explisam's user avatar
  • 749

1
2 3 4 5
9