|
Hi,
I have a static class, and it contains a private static member for resource management.
static class ConnectionManager
{
private static ResourceManager resmgr = new ResourceManager("myApplication.stringresources", Assembly.GetExecutingAssembly());
----------
--------
''''''''''''
}
initializing a static member this way, is this right way to do this?
every time when this class is called, would it reinitialize the static member, creating new memory allocation?
or would I have a single memory allocation alloted the first time class is refereneced?
Thanks,
herhighness
|
|
|
|
|
Yes, it is a right way.
The initialization of a static variable would be executed only once. You'll have the single memory allocated the first time class is refereneced.
Best,
Jun
|
|
|
|
|
Hi to all,
does any one knows how to resolve this problem
System.Ressources.MissingManifestRessourceException : Impossible to find the appropriate ressources for the specified culture of you assembly.
in fact, i have an image liste on a user control, and that's what is causing the problem, because when i delete the image list from the user control than i have no problem. if i try to put a new image liste, the message reappear again.
best regards and thanks in advance
fady
|
|
|
|
|
Hi all.
This question certanly not in properly place.But i consider what all who work with visual studio
may had response on one.
Some time ago i pass to use VS 2005.But there is one problem.When i edit an xsd file, IntelliSense work not how in VS 7. So three elements appear every time when i begin typed new element (< !-, < [, < ? ), how i can correct this behaviour.
Thank.
-- modified at 12:02 Wednesday 6th September, 2006
|
|
|
|
|
Hi I am trying to learn C# right now on the fly. I want to know if there is a way to implement a bitfield in C# as I would in C++
In C++ I would implement something like this:
typedef struct
{
union
{
unsigned short Value;
struct
{
unsigned short Test1_usec : 7;
unsigned short spare1 : 1;
unsigned short Test1Pass : 1;
unsigned short spare2 : 2;
unsigned short Test1Verify : 5;
}Bits;
}Word1;
union
{
unsigned short Value;
struct
{
unsigned short word2Data1 : 12;
unsigned short spare1 : 4;
}Bits;
}Word2;
} ARecvdMessage
what would the C# equivalent be for this struct?
Thanks.
|
|
|
|
|
they hide that information in the Documentation[^]
Unions[^]
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
Can you help with the code that will mimic the C++ code that I had posted? I read the articles but it doesn't behave as I would suspect it would. I am trying to read data from a serial port directly into this would be struct.
Thanks
|
|
|
|
|
NYTSX wrote: I read the articles but it doesn't behave as I would suspect it would. I am trying to read data from a serial port directly into this would be struct.
NYTSX wrote: Can you help with the code
Not a good idea since the code involves unmanaged memory that might lead to trouble if you are not familiar the issues. However this blog entry[^] should send you well on your way towards a solution.
Good luck
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
|
they hide that information in the Documentation[^]
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
Thank you very much. I had obviously overlooked that information.
Best regards,
Hampus
|
|
|
|
|
Hampus@foi wrote: I had obviously overlooked that information.
Just think of me as Helps help
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
This is probably something simple for those in "the know" but I'm not
part of this exclusive group. So any help would be very appreciated.
Any idea why this code:
public override void LoadData()<br />
{<br />
base.LoadData();<br />
if (!this.Page.IsPostBack) <br />
{<br />
ArrayList list;<br />
if ((DataSource == null))<br />
{<br />
list = new ArrayList();<br />
}<br />
else<br />
{<br />
list = new ArrayList(this.DataSource); <br />
<br />
}<br />
int i;<br />
for (i = 0; i < 50; i++)<br />
{<br />
list.Add(new LineScheduleRecord()); <br />
<br />
} <br />
this.DataSource = (LineScheduleRecord[])(list.ToArray(typeof(LineScheduleRecord)));<br />
}<br />
}
Would produce this error:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0029: Cannot implicitly convert type 'LINESCHEDULER.Business.LineScheduleRecord[]' to 'LINESCHEDULER.Business.LineScheduleAdminRecord[]'
Source Error:
Line 367: // list.Insert(i, new LineScheduleRecord());
Line 368: }
Line 369: this.DataSource = (LineScheduleRecord[])(list.ToArray(typeof(LineScheduleRecord)));
Line 370: }
Line 371:}
Check out my 7 Part Series on Networking[^]
Spyware Giving You Fits? Read My Latest Article.[^]
Welcome to the CodeProject!- أهلاً بكم في كود بروجكت
- Καλώς ήλθες στο τόπο τωνκοδικων - സീപിയിലേക്കൂ സ്വാഗതം - コード·プロジェクトへようこそ - Добро пожаловатьна - كوڈ ڀراجيكٹ ميں خوش آمديد - ಸೀಪೀ" ಗೆ ಸ್ವಾಗತ
|
|
|
|
|
it would appear that the error is in the error
Cannot implicitly convert type 'LINESCHEDULER.Business.LineScheduleRecord[]' to 'LINESCHEDULER.Business.LineScheduleAdminRecord[]'
the cast is wrong. perhaps you should have something like this:
this.DataSource = (LineScheduleAdminRecord[])(list.ToArray(typeof(LineScheduleRecord)));
regards,
g00fy
|
|
|
|
|
code-frog wrote: this.DataSource = (LineScheduleRecord[])(list.ToArray(typeof(LineScheduleRecord)));
What's the type of this.DataSource ? If it's LineScheduleAdminRecord[], then it looks like it's a cast problem. Of course, that's assuming list has LineScheduleAdminRecord instances.
|
|
|
|
|
This is actually a bug in Iron Speed Designer. I'm working with their support on it. Thank you though.
|
|
|
|
|
Hi All
I am writing a .net windows app that should also run from command line. I am not sure what is the best way to set such a project.
I intend to create a windows project and on the Sub Main rotine check if any arguments are passed. If not run a form.
Public Shared Sub Main(ByVal Params() As String)<br />
If Params.Length = 0 Then<br />
'run windows mode<br />
Application.Run(frmMain)<br />
else<br />
'run console application<br />
some code<br />
End If<br />
End Sub
Would this be the best way or is there any standard way of doing this ?
Many Thanks
Mustafa
www.hostukdomain.com
|
|
|
|
|
yes, thats the way to go. i guess thats the "standard" way too
|
|
|
|
|
Probably:
public static void Main(string[] args)
{
if (args.Length == 0)
{
Application.Run(new MainForm());
}
else
{
}
}
(NOTE: This is the C# forum)
|
|
|
|
|
Hello
I was wondering for some time about the difference between your approach -ie. main(string[] args) - and using Environment.GetCommandLineArgs() method to get the CommandLine arguments? Do you know which is better and why?
Regards
|
|
|
|
|
Nader Elshehabi wrote: Do you know which is better and why?
Neither is better.
It all depends on where in the application you are. If you don't store in the information in your Main() method, you can always get it from Environment.GetCommandLineArgs();
|
|
|
|
|
One problem guys.
I cannot get the console screen
The project needs to be setup as windows. (cannot setup as console type
when I write following
public static void Main(string[] args)<br />
{ <br />
if (args.Length == 0) <br />
{ Application.Run(new MainForm()); <br />
} <br />
else<br />
{
Console.Write("Hello");<br />
}<br />
}
thanks
Mustafa
www.hostukdomain.com
|
|
|
|
|
Surely that is just for debugging? No? When you run the application at a real command prompt it should work? (I don't have Visual Studio in front of me right now so I cannot test this)
|
|
|
|
|
|
Hello
i am devloping an application.
but how can i search for a file
|
|
|
|