Hi,
I have a class which will be used as a utility class (all its functions
shared, no need to instantiate it, let's say just to calculate things)
It needs a constant dictionary(of char, string) with 46 entries in it,
that is used in all its shared functions. How can I instantiate it
automatically only once, instead of creating it at each function call?
thanks!
ibiza 10 2076
Add a shared variable to hold the dictionary and populate it in the
class Initializer
e.g.
public class Something
private shared _dict as HashTable
shared sub new()
_dict = new ArrayList
' Add the items to the HashTable
end sub
end class
hth,
Alan.
You could expose this as a shared member initialized in the shared
constructor ?
Patrice
--
"ibiza" <la******@gmail.com> a écrit dans le message de
news:11**********************@f14g2000cwb.googlegr oups.com... Hi,
I have a class which will be used as a utility class (all its functions shared, no need to instantiate it, let's say just to calculate things)
It needs a constant dictionary(of char, string) with 46 entries in it, that is used in all its shared functions. How can I instantiate it automatically only once, instead of creating it at each function call?
thanks! ibiza
thanks! :)
I guess you both said the same thing?
is there a collection class that acts as a bidirectional dictionary?
I mean that if I add the entry (1, 42) in a dictionary, and I then do
dic(1), it will return 42.
but is there a class would return the same, but moreover if I do
dic(42), would return 1?
thanks! :)
Why not use an ArrayList and implement BinarySearch?
ibiza wrote: is there a collection class that acts as a bidirectional dictionary?
I mean that if I add the entry (1, 42) in a dictionary, and I then do dic(1), it will return 42. but is there a class would return the same, but moreover if I do dic(42), would return 1?
thanks! :)
"ibiza" <la******@gmail.com> schrieb: I have a class which will be used as a utility class (all its functions shared, no need to instantiate it, let's say just to calculate things)
It needs a constant dictionary(of char, string) with 46 entries in it, that is used in all its shared functions. How can I instantiate it automatically only once, instead of creating it at each function call?
\\\
Private Shared m_Bla As Dictionary = New Dictionary(...)
Private Shared ReadOnly Property Bla() As Dictionary
Get
Return m_Bla
End Get
End Property
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
because I mischose my example lol :\
replace the two ints with strings and here's my situation. Cannot use a
string as an index and implement binary search, can I?
because I mischose my example lol :\
replace the two ints with strings and here's my situation. Cannot use a
string as an index and implement binary search, can I?
use .IndexOf() for that
ibiza wrote: because I mischose my example lol :\
replace the two ints with strings and here's my situation. Cannot use a string as an index and implement binary search, can I?
could you please supply a concrete (but simple) example? :S I'm not
following you
thanks a lot! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Kyle |
last post by:
Hi,
Is it possible to initialize a constant memeber array in a class?
I tried several syntax but all failed.
class A
{
public:
A();
~A();
private:
|
by: vib |
last post by:
Hi there,
By chance, I came to learn that it is bad programming practice to
initialize global variables at outside of programs. Is it that bad? In
order to fullfil this, I had to declare them...
|
by: ibiza |
last post by:
Hi,
I have a class which will be used as a utility class (all its functions
shared, no need to instantiate it, let's say just to calculate things)
It needs a constant dictionary(of char,...
|
by: toton |
last post by:
Hi,
In C++ when I initialize an array it, also initializes the class that
it contains, which calls the default constructor. However, I want to
initialize the array only (i.e reserve the space) and...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |