473,503 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

structure

can somebody tell me what kind of structure is this,I haven't seen such a
structure in C# yet:

using(ISerializer questionSerializer = new QuestionSerializer())

{

oeq = (OpenEndedQuestion) questionSerializer.Deserialize(context, new
Guid(Request["QuestionGID"]));

}
Nov 16 '05 #1
2 1731
Reza,

Are you referring to the using statement? If that is the case, then
what that does is take a type that implements (or derives) from IDisposable.
When the block that follows the using statement is exited for any reason
(the code just exits, a return statement, an exception thrown), then the
Dispose method is called on the implementation of IDisposable.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Reza Alirezaei" <an*******@discussions.microsoft.com> wrote in message
news:el**************@TK2MSFTNGP09.phx.gbl...
can somebody tell me what kind of structure is this,I haven't seen such a
structure in C# yet:

using(ISerializer questionSerializer = new QuestionSerializer())

{

oeq = (OpenEndedQuestion) questionSerializer.Deserialize(context, new
Guid(Request["QuestionGID"]));

}

Nov 16 '05 #2
{this is a nice little bit of info from a web site that explains what I
think you are asking}

C# has a nice statement that automates dealing with the Dispose method. You
can use this statement with any class that implements IDisposable. If the
class does not implement IDisposable, you will get a compile error

using (MyClass myClass = new MyClass())
{
// do something with myClass
}

The above C# code is equivalent to :

MyClass myClass = new MyClass() ;

try
{
// do something with myClass
}
finally
{
myClass.Dispose() ;
}

As you can see, Dispose will always be called, even in the case of an
exception.

You can nest using statements and you can include multiple comma-separated
instantiations in the parantheses.
--

--

Br,
Mark Broadbent
mcdba , mcse+i
=============
"Reza Alirezaei" <an*******@discussions.microsoft.com> wrote in message
news:el**************@TK2MSFTNGP09.phx.gbl...
can somebody tell me what kind of structure is this,I haven't seen such a
structure in C# yet:

using(ISerializer questionSerializer = new QuestionSerializer())

{

oeq = (OpenEndedQuestion) questionSerializer.Deserialize(context, new
Guid(Request["QuestionGID"]));

}

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
11930
by: vikas | last post by:
I have following structure in c++. typedef struct MMF_result_struct { int action; char text; int cols,rows; int month,day,year; } MMF_result; Now this structure is shared between C++ and C#...
4
3877
by: marco_segurini | last post by:
Hi, From my VB program I call a C++ function that gets a structure pointer like parameter. The structure has a field that contains the structure length and other fields. My problem is that...
8
3311
by: Charles Law | last post by:
Can anyone suggest how I would marshal a variable length structure back from an API call. Specifically, I am looking at the WaitForDebugEvent function, which returns a DEBUG_EVENT structure. ...
15
8184
by: Charles Law | last post by:
I have adapted the following code from the MSDN help for PropertyInfo SetValue. In the original code, the structure MyStructure is defined as a class MyProperty, and it works as expected. There is...
3
8878
by: Kiran B. | last post by:
Hi, I am new to .net. I have two Data Structure Type ... Sturcture A and Structure B. Structure A Public Fname as String Public LastName as String Public City as String Public Zip as String...
14
1765
by: Dennis | last post by:
If I have a structure like; Public Structure myStructureDef Public b() as Byte Public t as String End Structure If I pass this structure, will the values in the array b be stored on the...
10
4967
by: David Fort | last post by:
Hi, I'm upgrading a VB6 app to VB.net and I'm having a problem with a call to a function provided in a DLL. The function takes the address of a structure which it will fill in with values. I...
11
1905
by: Lance | last post by:
Hi all, I've got a some structures defined as ////// <StructLayout(LayoutKind.Sequential)Public Structure GM_LayerInfo_t Public mDescription As String Public mNativeRect As GM_Rectangle_t...
4
1707
by: eBob.com | last post by:
In my class which contains the code for my worker thread I have ... Public MustInherit Class Base_Miner #Region " Delegates for accessing main UI form " Delegate Sub DelegAddProgressBar(ByVal...
5
3773
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post by:
Hi Willy, Thank you very much for your work. C++ code doesnot make any serialization. So at runtime C# code gives an serialization error at "msg_file_s sa = (msg_file_s) bf.Deserialize(ms);"...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.