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

VB.NET Shared

Hi,

what is the C# equivalent of VB.NET's Shared

e.g.

in VB.NET
Public Shared myColor As Color

does static do the same job?

public static Color myColor;

thanks,
Mori
Nov 15 '05 #1
4 15914
Dean <es*******@yahoo.co.uk> wrote:
what is the C# equivalent of VB.NET's Shared

e.g.

in VB.NET
Public Shared myColor As Color

does static do the same job?

public static Color myColor;


I believe so, yes - but I have a pretty limited grasp of VB.NET.
Basically static means that the field (or property, or method) doesn't
apply to a specific instance of the type, it applies to the type as a
whole.

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

"Dean" <es*******@yahoo.co.uk> сообщил/сообщила в новостях следующее:
news:O4**************@TK2MSFTNGP12.phx.gbl...
Hi,

what is the C# equivalent of VB.NET's Shared

e.g.

in VB.NET
Public Shared myColor As Color

does static do the same job?

public static Color myColor;

thanks,
Mori


Yes.
Nov 15 '05 #3
Yep

"Dean" <es*******@yahoo.co.uk> wrote in message
news:O4**************@TK2MSFTNGP12.phx.gbl...
Hi,

what is the C# equivalent of VB.NET's Shared

e.g.

in VB.NET
Public Shared myColor As Color

does static do the same job?

public static Color myColor;

thanks,
Mori

Nov 15 '05 #4
Hi!

Yes, "static" is the equivalent for VB.NET's "shared" keyword.

--

Regards,
Gaurav Khanna
----------------------------------------------------------------------------
----------------
Microsoft MVP - .NET, MCSE Windows 2000/NT4, MCP+I
WinToolZone - Spelunking Microsoft Technologies
http://www.wintoolzone.com/
"Dean" <es*******@yahoo.co.uk> wrote in message
news:O4**************@TK2MSFTNGP12.phx.gbl...
Hi,

what is the C# equivalent of VB.NET's Shared

e.g.

in VB.NET
Public Shared myColor As Color

does static do the same job?

public static Color myColor;

thanks,
Mori

Nov 15 '05 #5

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

Similar topics

10
by: John Brock | last post by:
I have a base class with several derived classes (I'm writing in VB.NET). I want each derived class to have a unique class ID (a String), and I want the derived classes to inherit from the base...
96
by: BadPony | last post by:
Anyone using Peoplesoft on a Federated UDB (shared nothing)Environment on Open System Platforms? Preferably AIX, but any war stories would be good. TEA EB-C
10
by: darrel | last post by:
I'm still trying to sort out in my head the differences between public and shared when referring to declaring properties or variables. This is my understanding: shared - akin to a 'global'...
1
by: Henri | last post by:
Hi, I'm using a custom class in my ASP.NET which has a Shared property. I don't want this Shared property to be shared between users because of thread concurrent accesses problems. I just want it...
2
by: tshad | last post by:
I have a program I am trying to compile into a dll and am getting a bunch of: the following errors: error BC30469: Reference to a non-shared member requires an object reference. At first, I...
11
by: tshad | last post by:
I am setting up some of my functions in a class called MyFunctions. I am not clear as to the best time to set a function as Shared and when not to. For example, I have the following bit...
15
by: Rob Nicholson | last post by:
A consequence of the ASP.NET architecture on IIS has just hit home with a big thud. It's to do with shared variables. Consider a module like this: Public Module Functions Public GlobalName As...
5
by: Erik Cruz | last post by:
Hello! I have read some threads discussing the fact that a module is in reality a shared class. If I try to create a Public Shared Class in vb.net I receive a compile error. Why? If I can't...
5
by: Simon | last post by:
Hi all, We have an ASP.NET 1.1 application running on IIS6 on Server 2003. Most of the base objects we are using in this application are taken from a windows application also written by us. We...
11
by: eBob.com | last post by:
I have this nasty problem with Shared methods and what I think of as "global storage" - i.e. storage declared outside of any subroutines or functions. In the simple example below this "global"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.