473,396 Members | 1,784 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,396 software developers and data experts.

C# local static data

Is there a C# equivalent to local static data.

I.e. in C:

int fred()
{
static int halibut = 0;

...
...

return (..);
}

Thanks.
Nov 15 '05 #1
2 3679
No such thing. I think the language designers want you to use static data
in some class for that purpose.
"Andrew Chalk" <ac****@XXXmagnacartasoftware.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Is there a C# equivalent to local static data.

I.e. in C:

int fred()
{
static int halibut = 0;

...
...

return (..);
}

Thanks.

Nov 15 '05 #2
Thanks!

"Fred Mellender" <no****************@frontiernet.net> wrote in message
news:71******************@news01.roc.ny...
No such thing. I think the language designers want you to use static data
in some class for that purpose.
"Andrew Chalk" <ac****@XXXmagnacartasoftware.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Is there a C# equivalent to local static data.

I.e. in C:

int fred()
{
static int halibut = 0;

...
...

return (..);
}

Thanks.


Nov 15 '05 #3

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

Similar topics

3
by: Tim Hill | last post by:
I'm just getting up to speed on Java, and have a question about local class behavior. Here's a mini-app to illustrate: interface Foo { void print(); } class LocalClassTest { public static...
2
by: Simon Harvey | last post by:
Hi everyone, I'm still abit confused about static methods accessing locally declared variables. For example public static bool executeNonQuery(){ SqlCommand cmd; SqlConnection con;
3
by: ishekara | last post by:
Hi, Can you solve the puzzle for me? I have a main.cpp, testinclude.h, and test1.cpp and test2.cpp which include testinclude.h testinclude.h has a class Include defined. I always thought that...
6
by: Michael | last post by:
I am running an application that requires "Full Trust" which is declared in the assembly. How do I trap for the System.Security.Policy.PolicyException that is raised by a local machines CAS if...
16
by: Chris | last post by:
Looking at some code I see a declaration inside a function like static const string s("some string"); Does the static serve any purpose here?
55
by: Zytan | last post by:
I see that static is more restricted in C# than in C++. It appears usable only on classes and methods, and data members, but cannot be created within a method itself. Surely this is possible in...
2
by: Filip Konvicka | last post by:
Hi all, I wonder whether anyone has seen a workaround for this somewhere, perhaps in Boost or elsewhere... I succeeded using a local type as template argument in MSVC 8.0, but I found out...
23
by: deepakvsoni | last post by:
Why does C++ restrict definition of functions with in functions? int f1() { int f2() { ..... } } //This is not supported. Thanks in advance to anybody who replies..
8
by: Rahul | last post by:
Hi, I have the following code and i get a compilation error, int main() { class Locale { public: static int c;
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...

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.