|
Hi Friends,
I have worked in Asp.net with Vb.net for 2 yrs. I have actainted with c,c++,java.Now i have shifted to another company.They are using C# completely.I have to learn C# as soon as possible.I have to learn C# in 7 days.My project is going to be started with in week. Even language is not barrier for any programmer.But it is need to learn the language for good work.Can u please proved some good links for learn c# as soon as possible.
and more thing is i have to learn design patterns.So can u please provide some links which are good one to learn quickly.
Thank you very much
Your help is appreciable
Regards
Kishore
|
|
|
|
|
kishorekumar.malla@live.com wrote: I have to learn C# in 7 days
Well, if you know VB, there's not much to learn. C# is strongly typed, apart from that, you should find it's often the same. I answer VB.NET questions all the time based on my C# knowledge, I never use VB.
kishorekumar.malla@live.com wrote: and more thing is i have to learn design patterns.
Well, this could be scary. You should buy the GoF book ( Design Patterns is it's name ), but I would be scared of a workplace that told you to 'learn design patterns in a week'. That's not really possible, and they can be over used and over rated.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
kishorekumar.malla@live.com wrote: Can u please proved some good links for learn c# as soon as possible.
www.codeproject.com
|
|
|
|
|
kishorekumar.malla@live.com wrote: Can u please proved some good links for learn c# as soon as possible.
If you decide to go with a book, I would recommend "Accelerated C# 2008." If I only had a week to learn such a broad subject, I'd rather have a printed reference I can flip through and carry around with me 24/7 rather than trying to piece together enough half-way decent references online.
As for "Accelerated C#," the description from Amazon is spot on:
Who is this book for?
If you’re an experienced C# programmer, you need to understand how C# has changed with C# 2008. If youre an experienced object–oriented programmer moving to C#, you want to ramp up quickly in the language while learning the latest features and techniques.
ssclaire
|
|
|
|
|
Two things make this a huge headache to solve. One problem is that when I get the error, it doesn't tell me when it occurs all the time. The other, I can't debug without Visual Studio very well.
Now, the error I get is an Access_Violation. I only know what line of code this occurs at if I try to run in fullscreen.
Here is the relavent code:
private void CreateDevice(Control Target)<br />
{<br />
int iAdapter = Manager.Adapters.Default.Adapter;<br />
<br />
presentparameters = new PresentParameters();<br />
#if DEBUG<br />
presentparameters.Windowed = true;<br />
#else<br />
presentparameters.Windowed = false;<br />
presentparameters.BackBufferCount = 1;<br />
presentparameters.BackBufferWidth = 800;<br />
presentparameters.BackBufferHeight = 600;<br />
presentparameters.BackBufferFormat = Manager.Adapters.Default.CurrentDisplayMode.Format;<br />
Target.Cursor.Dispose();<br />
#endif<br />
presentparameters.SwapEffect = SwapEffect.Discard;<br />
presentparameters.PresentationInterval = PresentInterval.Immediate;<br />
<br />
CreateFlags flags;<br />
Caps caps = Manager.GetDeviceCaps(iAdapter, DeviceType.Hardware);<br />
if (caps.DeviceCaps.SupportsHardwareTransformAndLight)<br />
{<br />
flags = CreateFlags.HardwareVertexProcessing;<br />
}<br />
else<br />
{<br />
flags = CreateFlags.SoftwareVertexProcessing;<br />
}<br />
<br />
if (caps.DeviceCaps.SupportsPureDevice)<br />
{<br />
flags = flags | CreateFlags.PureDevice;<br />
}<br />
<br />
device = new Device(iAdapter, DeviceType.Hardware, Target, flags, presentparameters);<br />
<br />
device.DeviceResizing += new System.ComponentModel.CancelEventHandler(OnDeviceResizing);<br />
}
Thanks for any help, feel free to ask for more code if you need it.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Does it work it windowed mode?
Try changing the Target object type to a Form instead of a Control (not sure if this will make any difference).
Otherwise have a look at this article:
http://www.codeproject.com/KB/directx/InitialisingDirect3D.aspx
And see if that works. If it does then you can narrow down the problem.
|
|
|
|
|
Hello,
First of all, I do realise that the following description is incomplete and it is probably impossible to deduce the exact causes of the problem from it -- the code I'm working on is simply too long to post here in full. I would, however, be very grateful for any hints on how to debug it, or pointers to useful resources on the subject.
Here's what I'm struggling with:
I'm working on an RSS aggregator in C#. As the network functions are blocking, I use a separate thread for updating the feed subscriptions. The update function generates events which are then caught by each notification 'subsystem' (popup notifiers, tray icon and context menu for now). Realising that UI controls have to be updated from the thread they were created in, I added appropriate InvokeRequired clauses everywhere an event cause the UI to update -- as described in MSDN help. The manual suggests that this should solve the problem but despite that the program crashes frequently. I get the following exception:
<br />
Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.<br />
The error occurs when I click on the tray icon just after the feeds have been updated, presumably when the events are still propagating (new items are individually added to the context menu, in the tests I'm using there can be up to about 150 of them).
I also looked through a more extensive guide on the subject of threads in general 'Multi-threading in .NET: Introduction and suggestions' (http://www.yoda.arachsys.com/csharp/threads/) but nothing useful came up.
Here's an example of event handler (taken from the tray icon context menu class):
<br />
private delegate void subscriptions_FeedsUpdatedCallback(object sender, FeedsUpdatedArgs e);<br />
<br />
void subscriptions_FeedsUpdated(object sender, FeedsUpdatedArgs e)<br />
{<br />
if (this.InvokeRequired)<br />
{<br />
var d = new subscriptions_FeedsUpdatedCallback(subscriptions_FeedsUpdated);<br />
this.BeginInvoke(d, new object[] { sender, e });<br />
}<br />
else<br />
{<br />
HideInfoItem();
<br />
foreach (var menu in FeedMenus)
menu.Visible = true;<br />
<br />
foreach (Subscription feed in subscriptions.Channels)<br />
{<br />
ToolStripMenuItem menuItem = (ToolStripMenuItem)(this.Items.Find(feed.Name, false))[0];<br />
foreach (Rss.RssItem newitem in feed.NewItems)<br />
menuItem.DropDownItems.Add(newitem.Title);<br />
}<br />
}<br />
}<br />
I think that's the most relevant code snippet I can provide, I would be more than happy to provide others as needed.
I'm at my wits end as to how this issue should be fixed. One workaround that came to me was to introduce event buffering for each subsystem, with explicit yields to the GUI thread but as I don't fully understand why the errors occur, I can't be sure if that would help at all.
How should I proceed?
TIA,
Gre
|
|
|
|
|
Jergosh wrote: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.
You can actually turn this error off if you want to, but it makes more sense to work around it. The way I do it is to do threading with the BackgroundWorker class, and to use the reportProgress method to fire a message back to the main thread, which then is where I update UI.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I've seen the exception thrown when you are calling BeginInvoke on a control that has been instantiated but has not yet become visible. .NET 2.0 apparently creates the backing Win32 handle lazily, when the control is about to become visible for the first time, and if you happen to call Invoke/BeginInvoke before it, it fails with that error.
Can you try accessing the
Handle in the constructor of that control? This forces creation of the underlying handle. <br />
<br />
<div class="ForumSig">Regards<br />
Senthil [MVP - Visual C#]<br />
_____________________________<br />
<font face="Verdana" size="1"><a href="http://msmvps.com/blogs/Senthil">My Blog</a> | <a href="http://www.codeproject.com/script/articles/list_articles.asp?userid=492196">My Articles</a> | <a href="http://www.flickr.com/photos/senthilkumar/">My Flickr</a> | <a href="http://geocities.com/win_macro">WinMacro</a></font></div>
|
|
|
|
|
S. Senthil Kumar wrote: I've seen the exception thrown when you are calling BeginInvoke on a control that has been instantiated but has not yet become visible. .NET 2.0 apparently creates the backing Win32 handle lazily, when the control is about to become visible for the first time, and if you happen to call Invoke/BeginInvoke before it, it fails with that error.
This sounds very promising as the controls are indeed hidden -- do you know if this bug applies to .NET 3.5?
Cheers,
Greg
|
|
|
|
|
Hi I have just started learning C#
I have installed Visual studio 2005
when I tried to run a C# program,got an error csc is not recognised
I dont know what to do
I tried to google it
got response To fix this problem, execute the batch file corvars.bat located
in the bin directory of the SDK. Change directories to the Framework
SDK root directory, normally installed in the directory \Program Files\
Microsoft.NET\FrameworkSDK\bin. Execute the batch file by typing
corvars on the command line. Now change directories back to where
your program is saved and compilation should be successful
i tried my best but no result
Plz help
Regards
Kuldeep
|
|
|
|
|
Use the visual studio command prompt and not the regular command prompt.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
From where you are executing Csc Command ?
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
Hello
I've made tho following function in a form to avoid to open severall instance a child form dialog
It works fine but I do'nt know how to check if the user ave close the form from itself!
Because in such situation FrmZTour remain not null and I got an error !
private void ShowForm(DataTable dtDagChauff)<br />
{<br />
if (FrmZTour == null )<br />
{<br />
FrmZTour = new FrmDgvZoomTour();<br />
FrmZTour.SelectTour += new FrmDgvZoomTour.SelectTourHandler(DgvTourSelected);<br />
FrmZTour.Show(this);<br />
}<br />
<br />
FrmZTour.FillDgv(dtDagChauff);<br />
}
|
|
|
|
|
EDIT: Forget that, apparently you can't re-show a form after its closed. But i did find the solution, the form should have an IsDisposed property, so you need to check that as well:
if(FrmZTour == null || FrmZTour.IsDisposed)
That should sort it out.
My current favourite word is: Bacon!
-SK Genius
Game Programming articles start - here[ ^]-
modified on Monday, May 12, 2008 8:28 PM
|
|
|
|
|
Thank you
Finaly I did adapt your first sugestion
<br />
private void ShowForm(DataTable dtDagChauff)<br />
{<br />
if (FrmZTour == null )<br />
{<br />
FrmZTour = new FrmDgvZoomTour();<br />
FrmZTour.SelectTour += new FrmDgvZoomTour.SelectTourHandler(DgvTourSelected);<br />
FrmZTour.Closed += new EventHandler(this.formClosed);<br />
FrmZTour.Show(this);<br />
}<br />
<br />
FrmZTour.FillDgv(dtDagChauff);<br />
}<br />
private void formClosed(object sender, EventArgs e)<br />
{<br />
FrmZTour.Dispose();<br />
FrmZTour = null;<br />
}
|
|
|
|
|
It has a Visible property.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm trying to build a high performance windows application that does basic calculations on many different data sets. Can anyone explain to me why this always returns false???
int[] x = new int[10] { 10015, 10, 9, 8, 7, 6, 5, 4, 2, 2 };
int[] y = new int[10] { 10015, 10, 9, 8, 7, 6, 5, 4, 3, 2 };
if (x.Equals(y)) return true;
else return false;
I'm pretty sure that .Equals is comparing the ADDRESS of the two arrays, as opposed to the values. Can someone help me out on what the fastest way of comparing these arrays?? no looping is HIGHLY preferred.
|
|
|
|
|
shamidi wrote: no looping is HIGHLY preferred.
Depends on what level you want that to occur on. Using LINQ there's no "looping" on the surface but it'll translate into a loop.
You have to face facts, you've got an array of data, you have to loop to do anything useful with it.
In response to your first point, Equals is comparing the addresses but because you're initialising them independently they are in fact in two different blocks of memory, thus not the same.
It would return true (I think) if you did:
int[] x = new int[10] { ... };
int[] y = x;
return x.Equals(y);
See that last line? What you've just done there is a coding horror (check the forums), your comparing a bool to return a bool You can simplify the code (and the resulting assembler) by doing what I did.
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
Ed.Poore wrote: See that last line? What you've just done there is a coding horror (check the forums), your comparing a bool to return a bool [WTF] You can simplify the code (and the resulting assembler) by doing what I did.
Sorry about that....wrote a quick snippet to get posted.
The reality is that this a small piece of a huge block of code that isn't working because of this reference issue.
int[] x = new int[10] { ... };
int[] y = x;
this doesn't help me a lot, seeing as how the two int[] arrays that I'm trying to compare are created in two separate areas of the code...I need to see if the result of both methods are the same, and if they are, ignore one of them. The arrays int[] arrays look exactly as those that I wrote in my previous post.
Is there another data type that you can think of to use to resolve this? Or am I screwed into looping? The looping is killing me on performance.
|
|
|
|
|
First question are both guaranteed to be the same length?
Secondly how do you mean equal, both have the same values in the same positions or simply contain the same integers but in different locations?
If 1 is false and 2 implies both in the same order and value then the fastest way would be:
if (x.Length != y.Length)
return false;
for (int i = 0; i < x.Length; i++)
{
if (x[i] != y[i])
return false;
}
return true
This code will work based on the fact that they are equal under the condition that both arrays have the same values at the same indicies. Obviously you could tailor this algorithm slightly because if you know differing values are likely to occur at the end of the array then you can loop backwards thus hitting the difference first.
You will have to loop regardless, even if you went down to assembly then the processors will only be able to handle a maximum (I think) of a 64-bit bitwise operation (if you're lucky) so they will have to loop anyway.
If you're still having issues with performance, is your code running on a multicore processor? If so and you still want to go through C# (note I have seen some statistics where C# can out perform C++ but for the life of me I can't remember which areas they are, so you might as well stick with it); anyway if you are running on a multicore then you might want to take a look at the Parallel Extensions for .NET[^]. Which can through a "simple" syntax optimise your loops to run on multicore processors (or leave it alone for single cores).
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
I'm pretty sure that all of the VS versions come with a debugger. Ever thought of trying it?
As far as the comparison is concerned, you have to give us more info - do the arrays only match if it contains the same set of numbers? Does it only match if all of the elements are in the same order? Are both arrays always going to be the same size?
It looks like a loop is your only viable choice of testing for equality. Here's one approach given the array and the order of elements specified:
bool matches = true;
for (int i = 0; i < x.Length; i++)
{
matches = (((x[i] + y[i]) % 2) == 0);
if (!matches)
{
break;
}
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: I'm pretty sure that all of the VS versions come with a debugger. Ever thought of trying it?
Debugger? Weird...I'll MSDN it, must've slept through that day of programming school.
Thanks for the snippet.
|
|
|
|
|
What about:
bool matches = true;
for(int i=0; i<x.Length; i++) {
matches = ( (x[i]&y[i]) == x[i] );
if(!matches)
break;
}
EDIT: Then again if x[i] = 00001111, and y[i] = 11111111. Then x[i]&y[i] = 00001111. But still.
Binary operators should be faster right? Although, whats wrong with plain old if(x[i] == y[i]) ?
My current favourite word is: Bacon!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
You can't apply & or | to integer values like that, so I guess that would make them slower.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|