|
I don't really like the aliases, in my opinion their primary use is to save keystrokes*, but I use them.
One of the odd things about them is that they're required for enumerations:
enum ThisEnum : int ...
enum ThatEnum : System.Int32 ...
And I seem to recall that there are situations where you can't use them, but I could be wrong about that.
* More importantly, they can ease the conversion of C/C++ code to C#, but how many people do that?
|
|
|
|
|
Trying to communicate with a java webservice that utilizes SwA instead of MTOM which is standard in Web Enhancments. Could anyone please tell me how I can do a SwA message in .NET?
|
|
|
|
|
Hi
(This is my first web service project so please point out if I've made any fundamental mistakes here.)
I have a problem using WCF .NET 3.5 VS2008 trying to create a c# client app that interacts with a 3rd party web service that uses SWA.
I have found that WCF .NET 3.5 does not support SWA. SWA was available as part of Web Services Enhancements (WSE) 3.0 for Microsoft® .NET VS2005 but WSE has not been updated for .NET 3.5 VS2008
The 3rd party web service wsdl is incompatible with wsdl.exe from .NET 3.0 so I cannot use VS2005 / .NET 3.0
I can create a service reference in VS2008 but it ignores the SWA (I think by design).
I think I have 2 choices - read up on wsdl so that I can modify the wsdl to be compatible with the VS2005 environment, or find a way to support SWA in VS2008.
Is this same as your problem?
Does anyone know of a solution for SWA with VS2008 .NET 3.5?
Thanks
A
|
|
|
|
|
Or will it freeze the application a little when doing garbage collection?
system
|
|
|
|
|
The GC will still freeze your application's main thread (and any child threads). Due to the way the GC works, this behavior will never change. It freezes the threads so it can "walk" the heap looking for reachable objects. If your application were still running, the GC would always be chasing it's tail and never be able to make any decisions.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
So can I disable auto garbage collection?
system
|
|
|
|
|
No. It's part of the .NET runtime itself and there is no way to turn it on or off.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Why would you want to? Seriously, why? This is the mechanism by which memory is reclaimed for your application. Do you really want your application to start leaking memory? To me, GC was one of the great features of .NET, and was an absolute godsend for me - coming from a C++ background, where you had to be so careful of how memory was allocated and freed, it's a relief to let the framework take care of this for me.
|
|
|
|
|
I agree with you. Gabage collection is really good.
When I used shared_ptr the first time, I can see how much it can clarify the code.
I know it can work well in .Net, but I just don't like the way it works (searching, freezing).
Does it have something better than garbage collection in real life?
Is the garbage in the bin useable in .Net? If not, why not clear it as soon as possible?
system
|
|
|
|
|
followait wrote: If not, why not clear it as soon as possible?
If you clear it straight away, you would introduce slow downs into your application because you'd be collecting pretty much every variable immediately. The garbage collection algorithm is pretty sophisticated, and is much less intrusive. I don't know if you've read up on it, but if you haven't you really should - it's enlightening.
|
|
|
|
|
Pete O'Hanlon wrote: I don't know if you've read up on it, but if you haven't you really should - it's enlightening.
Thanks. I'll learn it before I learn .Net .;P
Pete O'Hanlon wrote: If you clear it straight away, you would introduce slow downs into your application because you'd be collecting pretty much every variable immediately.
Usually, it has no problem, and memory pool can be used when necessary.
Pete O'Hanlon wrote: The garbage collection algorithm is pretty sophisticated
So it's hard to tell the good and the bad of it.
system
modified on Friday, September 19, 2008 8:37 PM
|
|
|
|
|
The garbage collector doesn't introduce noticable pauses unless you are really abusing it.
If you really have a pressing need to be constantly creating and destroying lots of tiny objects then use a resurrection pattern.
What scenario do you have where its not working well for you?
|
|
|
|
|
The problem is when GC is not necessarily, I also have to use it.
Just too rich.
More local variables mean higher cohensive
Less function parameters mean looser coupling
|
|
|
|
|
If you don't like the garbage collector, then program in a none-managed language and manage all your memory requirements yourself. Then you'll come to know and love the GC.
|
|
|
|
|
I'm programming using C++ now, and sure that GC is very good when I need it.
More local variables mean higher cohensive
Less function parameters mean looser coupling
|
|
|
|
|
If the GC really isn't necessary for your usage scenario, then its won't spent any time collecting, and will run less frequently. If you think the GC is causing a problem in your program, then I suggest you first tell us what the ".Net Memory\% time spent in GC" performance counter reads.
The only performance bottlenecks I have seen in real world applications in my consulting role is due to poor programming (usually by people thinking they can do a better job than the experts).
|
|
|
|
|
If a specific part of the application has a real time demand, it'll be better if GC can be diabled
temporally.
I've just read it in MSDN, there are latency modes for it.
It survives.
More local variables mean higher cohensive
Less function parameters mean looser coupling
modified on Thursday, September 25, 2008 7:41 AM
|
|
|
|
|
If the application really has a realtime demand then you run it on a real time OS.
You shouldn't be considering doing anything in .Net if the slight interruptions of the GC are going to be an issue. There are plenty of other things that can interrupt execution on that platform.
|
|
|
|
|
No it's not. But Eiffel, for example, has per thread garbage collection. Problem is it has miniscule industry use.
Kevin
|
|
|
|
|
Can I disable auto garbage collection in .Net?
system
|
|
|
|
|
Nope. If you did, you'd run out of memory VERY quickly.
|
|
|
|
|
I was using a project for months, no problem.
Something changed 3 days ago in my project. Now it won't compile/run.
It complains that every class in App_Code folder doesn't exist. They worked fine before.
The files exist. The folder exists.
I rename the Utilities.vb file and create a new one. Still says class undefined.
I started a new Web App. Right-click on project->Add->Folder->App_Code (since the menu item App_Code isn't an option)
Add a class to App_Code. I notice the Build Action is Compile.
Switch back to 1st project. None of the classes are set to Compile. Okay, change that, Run.
Now, it Builds the project, but the web server complains the classes are AMBIGUOUS. Make up your bloody mind.
Compiler Error Message: BC30175: class 'Utilities' and class 'Utilities', declared in 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\2d7f8030\4e18611d\App_Code.idisyg3r.3.vb', conflict in namespace '<Default>'.
Source Error:
Line 9: Imports CrystalDecisions.CrystalReports.Engine
Line 10:
Line 11: Public Class Utilities
Line 12: Public Shared Function GetAuthenticationTypes() As IDictionary
Line 13: Dim mySortedList As IDictionary = New SortedList()
After 3 days of beating my head in, I realize my renamed class which is Excluded from the project, but still in the folder, is causing this. I delete it.
Why on Earth would Studio interpret a class Excluded from the project just cause it's in the folder?
And how did all my classes get set to Content, not Compile?
Cheetah. Ferret. Gonads. What more can I say? - Pete O'Hanlon
|
|
|
|
|
i'm not positive about this, but it would appear that the IDE doesn't compile your web application, the asp.net compiler does; and it likes to compile everything in the web directory, whether it is part of your project or not
|
|
|
|
|
Hi,
I am creating a windows application in which i have got a DataGridView containing some comboboxes and checkboxes. Is there a way to fill the DataGridView from the database. Now i am filling the datagrid cell by cell seperately. Also there exist problem while updating the database. I am giving my code with this. Will anyone help me out of this.
1 public void LoadData(int tabcnt)
2 {
3 string module = this.tabControl1.SelectedTab.Text.Trim();
4
5 string connString;
6
7 string query = "";
8
9 connString = ConfigurationSettings.AppSettings.Get("ProjDB").ToString().Trim();
10
11 if (module != "")
12 {
13 query = "SELECT * FROM Module_Requirements where Module='" + module + "'";
14 }
15 else
16 {
17 MessageBox.Show("There Is No Modules", "No Modules", MessageBoxButtons.OK, MessageBoxIcon.Information);
18 }
19
20 dAdapter = new MySqlDataAdapter(query, connString);
21
22 MySqlCommandBuilder cBuilder = new MySqlCommandBuilder(dAdapter);
23
24 DataSet ds = new DataSet();
25
26 ds.Clear();
27
28 try
29 {
30 dAdapter.Fill(ds);
31 BindingSource bSource = new BindingSource();
32 }
33 catch (Exception ex)
34 {
35 MessageBox.Show(ex.Message);
36 }
37
38
39
40 int iRowCnt = ds.Tables[0].Rows.Count;
41
42 ucMod[tabcnt].gridLineDataGridView1.Rows.Clear();
43
44 for (int ctrRow = 0; ctrRow < iRowCnt; ctrRow++)
45 {
46 ucMod[tabcnt].gridLineDataGridView1.Rows.Add();
47 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[1].Value = ucMod[tabcnt].Column2.Items[ucMod[tabcnt].Column2.Items.IndexOf(ds.Tables[0].Rows[ctrRow][1].ToString().Trim())];
48 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[2].Value = ds.Tables[0].Rows[ctrRow][0].ToString().Trim();
49 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[3].Value = ds.Tables[0].Rows[ctrRow][2].ToString().Trim();
50 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[4].Value = ds.Tables[0].Rows[ctrRow][3].ToString().Trim();
51 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[5].Value = ds.Tables[0].Rows[ctrRow][4].ToString().Trim();
52 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[6].Value = ds.Tables[0].Rows[ctrRow][5].ToString().Trim();
53 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[7].Value = ds.Tables[0].Rows[ctrRow][6].ToString().Trim();
54 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[8].Value = ucMod[tabcnt].Column9.Items[ucMod[tabcnt].Column9.Items.IndexOf(ds.Tables[0].Rows[ctrRow][7])];
55 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[9].Value = ucMod[tabcnt].Column10.Items[ucMod[tabcnt].Column10.Items.IndexOf(ds.Tables[0].Rows[ctrRow][8].ToString().Trim())];
56 }
57 }
Thanks
Akhil
|
|
|
|
|
Hi,
at first, use parametrized SqlCommands instead of joining strings, this is very big security hole.
To your question. Just try this:
DataGridView dgv = new DataGridView();
dgv.DataSource = ds.Tables["your_table"];
It should be working, but i cut it off from "Filling DataGrid", where you assign this DataGridView to DataGrid.DataSource . Maybe the DataGridView is filled only when it is used, for ex. with DataGrid .
And what is ucMod[tabcnt].gridLineDataGridView1 ?
|
|
|
|