473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 1257
<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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.