473,473 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Explicitly Calling Variable Initailzers on uninitalized Object?

Doe anyone know the way to explicitly call the varible initializers on
an object?

for instance

Class A
{
private int a=123;
}

object shell=FormatterServices.GetUninitializedObject(typ eof(A));

// Here is where I want to run the value initalizers to fill in a

I know the framework does this to initalize NonSerilized Fields during
deserilization.

Any help appreciated

Tom

Jul 21 '05 #1
1 1259
<ts******@gmail.com> wrote:
Doe anyone know the way to explicitly call the varible initializers on
an object?

for instance

Class A
{
private int a=123;
}

object shell=FormatterServices.GetUninitializedObject(typ eof(A));

// Here is where I want to run the value initalizers to fill in a

I know the framework does this to initalize NonSerilized Fields during
deserilization.

Any help appreciated


The initialisers only exist in the construtors as far as I'm aware, so
you really need to call a constructor.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2

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

Similar topics

10
by: R.G. Vervoort | last post by:
I am using a javafunction (onclick in select) in which i am calling a function in php (thats why i send this to both php and javascript newsgroups). in the onclick i call the function...
12
by: Josef Dalcolmo | last post by:
If I have a Python variable like var = 33 can I get the name 'var' as a string? Obviously this does not make much sense when using a single variable, but if I want to print the variable...
1
by: tsteinke | last post by:
Doe anyone know the way to explicitly call the varible initializers on an object? for instance Class A { private int a=123; }
7
by: engaarea | last post by:
hi all, What are the circumstances in which one would have to call a destructor explicitly. Regards 5
3
by: Kavya | last post by:
Suppose I have class MyClass. Then which will be termed as explicit call to constructor. MyClass( ); or MyClass object; object.MyClass( );
3
by: NightCrawler | last post by:
Hi can i call a constructor of a class, if the name is stored in a CString Object e.g. class CBaseClass { int x; };
8
by: Jeff | last post by:
Still new to vb.net in VS2005 web developer... What is the proper/standard way of doing the following - setting the value of a variable in one sub and calling it from another? E.g., as below....
2
by: Studlyami | last post by:
After i create an object can i call the constructor again to reinitialize that objects variables? I know i can create a function to do this, but i was wonder if i can just call the constructor again....
1
by: 55555 | last post by:
what is difference between variable type and object type??
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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
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,...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.