using

Why can't I put a "using" declaration inside a class declaration?

I understand the troubles you can get into when you put a using declaration inside a header file, so I don't want to do that. Instead I tried to put the using (or a namespace foo =) within the class declaration, to cut down on repetitive typing within the header file. Unfortunately I get compiler errors. Seems like it would be a usefu...

What does Using(.....){...} mean

Possible Duplicates: Using the using statment in c# What is the C# Using block and why should I use it? Just wondering what this means? I've seen lots of tutorials online that have the syntax: using (SqlCeCommand cmd2 = new SqlCeCommand("SELECT city FROM cities JOIN states ON states.id=cities.state WHERE states.state='" + r...

how to use haru?

can anyone help me on how to use libharu. i already downloaded libharu and am trying to run their sample demo in dev-c++ environment but the errors a raises. this is the error message: C:\DOCUME~1\ITCPIA~1\LOCALS~1\Temp/ccUDbaaa.o(.text+0x6d):text_demo.c: undefined reference toHPDF_Page_SetRGBStroke'` ...

Can I undo the effect of "using namespace" in C++?

With using namespace I make the whole contents of that namespace directly visible without using the namespace qualifier. This can cause problems if using namespace occurs in widely used headers - we can unintendedly make two namespaces with identical classes names visible and the compiler will refuse to compile unless the class name is p...

How to delete data from a powerpoint slide using c# code

Can you please help me in writing a code to delete images from a particular slide in powerpoint using C# ...

c# - is it ok to embed a "try/catch" within a "using" statement for a web request? Is my code correct?

Hi Is it ok to embed a "try/catch" within a "using" statement for a web request? Is my code correct? That is my requirements are: Want to use the "using" statement to make sure resources are released in any case for HttpWebResponse But still want to do some custom stuff if there is an exception re HttpWebResponse and "response = (...

What requires me to declare "using namespace std;"?

This question may be a duplicate, but I can't find a good answer. Short and simple, what requires me to declare using namespace std; in C++ programs? ...

Using `using(...)` effectively useless and/or inefficient???

Does the following code render the using(...) function/purpose irrelevant? Would it cause a deficiency in GC performance? class Program { static Dictionary<string , DisposableClass> Disposables { get { if (disposables == null) disposables = new Dictionary<string , DisposableClass>(); ...

C#: using block: object re-initialization

Re-initialization within "using" block is a bad idea, to be avoided at all times. Still i am going to ask this: Why does "using" call dispose on the original value and not on the last reference or re-initialization (which happens if try finally block is used) MyClass b = new MyClass();// implements Idisposable MyClass c = new MyClass(...

Does a using block create and maintain a reference for the GC?

This is mostly for curiosity's sake, as there are better ways of implementing almost any use case I can think of for this construct (in C# and other languages I use regularly, at least), but I recently saw on here a scoped mutex which was a cool concept. My question is, does the using statement maintain a reference (ie: prevent the GC f...

Usage of a using statement

Possible Duplicates: Which is better, and when: using statement or calling Dispose() on an IDisposable in C#? When should I use using blocks in C#? using a using if statement? Properly, how will I use a using statement? I have a tutorial open and i do not understand it. And i can see more than 1 different ways to implement...

Are there any side effects of returning from inside a using() statement?

Returning a method value from inside a using statement that gets a DataContext seems to always work fine, like this: public static Transaction GetMostRecentTransaction(int singleId) { using (var db = new DataClasses1DataContext()) { var transaction = (from t in db.Transactions orderby t.When...

C# namespace / class in seperate file causing errors upon viewing

I have two projects 'HOD', and 'Controllers'. Controllers is a class library with a namespace of 'Controllers'. In the code file for HOD I am trying to reference the Controllers namespace by 'using Controllers'. I added a reference in the HOD project to Controllers and it does show up in VS2008 under the references folder. When I bui...

What gets disposed when "using" keyword is used

Let's have an example: using (var someObject = new SomeObject()) { var someOtherObject = new SomeOtherObject(); someOtherObject.someMethod(); } SomeOtherObject also implements IDisposable. Will be SomeOtherObject also disposed when SomeObject get disposed ? What will happen to the SomeOtherObject ? (disposing of SomeOtherOb...

Scala: "using" keyword

i've defined 'using' keyword as following: def using[A, B <: {def close(): Unit}] (closeable: B) (f: B => A): A = try { f(closeable) } finally { closeable.close() } i can use it like that: using(new PrintWriter("sample.txt")){ out => out.println("hellow world!") } now i'm curious how to define 'using' keyword to take any number...

How to use private key

Hi, In my search i found out that we can generate private key called myrsakey.pem.What is the purpose of this key where this key is used.Help me. Regards Sharun. ...

How do I parse this json with php and upload some elements to Amazon S3?

Hello All, I have to import from an api http://somegoodrecipe.com/recipes/?format=json. It has 5 components: recipe_id recipe_title recipe_thumbnail (image) recipe_swf_url (flash) recipe_description I can use this to print it out: $json = file_get_contents("http://somegoodrecipe.com/recipes/?format=json", true); $decode = json_dec...

How to redirect page

Hi i created one java application in which i tried to open my company's standard login page and i planned to redirect the link to open my own design page. Standard login page is displayed, instead of going to my own design page as usual its going to mail page. After sign out the mail page i'm gettting my own design page. But my need is,...

Dynamics of the using keyword

Consider the following code: // module level declaration Socket _client; void ProcessSocket() { _client = GetSocketFromSomewhere(); using (_client) { DoStuff(); // receive and send data Close(); } } void Close() { _client.Close(); _client = null; } Given that that the code calls the Close() meth...

C# using statement with a null object

Is it safe to use the using statement on a (potentially) null object? I.e. consider the following example: class Test { IDisposable GetObject(string name) { // returns null if not found } void DoSomething() { using (IDisposable x = GetObject("invalid name")) { if (x != null) { //...