Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

When to ue the new keyword

$
0
0

Mostly when I want to create an object, I do something along the lines of:

MyClass MyObject = new MyClass();

but sometimes I see code that creates an object (or is it simply a variable?) without the new keyword and the "constructor" looks like something entirely different.

CloudBlobClient blobClient =account.CreateCloudBlobClient();

Is this saying "blobClient" isn't an object?

It looks similar to something I would understand:

int numCustomers = customer.Count();

Whereas I understand what an int is and why I wouldn't use the new keyword with it - in the above example, is blobClient just a variable of type CloudBlobClient and it's not an object?

How would I define the type CloudBlobClient?

Sorry for the basic questions - I'm a novice at this programming stuff...


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>