|
Have look at NUnit source code
|
|
|
|
|
Still it is not answered my question...
Through reflection how much safe to access private members ?
It is violating OOPs concepts..
Regards,
Kiran Kumar Singani
|
|
|
|
|
It is not safe because you try to access methods at run time using "reflection".
Use SecurityPermissionAttributes on your private methods for which you want to access.
What is the reason behind accessing a private mthod. Do it public then.
As a design rule, make things non-punlic if you don't neeed them or if you want to secure them.
Have alook at .NET Reflector tool which disassembles any .NET assembly to it's original source code using reflection including of course the private ones. Which means you can access but this tool also shows how unsecure your private methods are. To call these methods, I've not tried actually but as I said, try to make them internal or private and add SecurityAttributes to ptotect.
Hope this helps...
|
|
|
|
|
How can i create a object of a class....if the constructor of that class is private??
Thanks
|
|
|
|
|
Test270307 wrote: How can i create a object of a class....if the constructor of that class is private??
You can't unless the class gives you a way to create instances other than using the constructors, e.g. static factory methods.
|
|
|
|
|
If it's private, it's for a reason, usually to force you to use a factory method ( as in a static ClassName.Create type method )
In C++, friend classes make this a lot more powerful.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Check out the Factory method and Singleton patterns. You will have a public method, typically called Create() or GetInstance() that calls the private constructor.
Cheers,
Vıkram.
Déjà moo - The feeling that you've seen this bull before.
Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
I want to access Local Security Policy (User Rights assignment) using C#. Is it possible?
My requirement is to add/remove users from certain policies programatically.
Thanks,
Pranav
|
|
|
|
|
One Post is Enough.
Regards,
Satips.
|
|
|
|
|
I think you should use IEnumerator iHeirarchy = SecurityManager.PolicyHierarchy(); then you can loop each policy level PolicyLevel polLevel = iHeirarchy.Current as PolicyLevel; and then you can get the codegroup by taking polLevel.RootCodeGroup.Children or get the named permission set polLevel.NamedPermissionSets from here you can manipulate whatever you wan't like removing or adding.
|
|
|
|
|
|
I want to access/modify Local Security Policy (User Rights Assignment) using C#. Is it possible?
My requirement is to add/remove a user from a certain policy.
Thanks in advance,
Pranav
|
|
|
|
|
One Post is Enough.
Regards,
Satips.
|
|
|
|
|
hi,
my problem is how to select data from datagridview1 and transfer the selected data by double clicking the row to datagridview2?
my code:
private void dataGridView3_DoubleClick(object sender, EventArgs e)
{
long itemcode =0;
string description = "";
itemcode = Convert.ToInt64(dataGridView3.Rows[dataGridView3.CurrentRow.Index].Cells[0].Value.ToString());
description = dataGridView3.Rows[dataGridView3.CurrentRow.Index].Cells[1].Value.ToString();
DataGridViewCell itemCodeCell = new DataGridViewTextBoxCell();
itemCodeCell.Value = itemcode;
DataGridViewCell descriptionCell = new DataGridViewTextBoxCell();
descriptionCell.Value = description;
DataGridViewRow row = new DataGridViewRow();
row.Cells.Add(itemCodeCell);
row.Cells.Add(new DataGridViewTextBoxCell());
row.Cells.Add(new DataGridViewTextBoxCell());
row.Cells.Add(descriptionCell);
string[] rows = new string[]{ itemcode.ToString(), "", "", description };
dataGridView4.Rows.Add(rows);
}
it seems that my program is correct but i receive an exception error on the last part of my code... dataGridView4.Rows.Add(rows);
Exception error message received:
Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound.
what will i do??pls. help..
jing
jing
|
|
|
|
|
Hi I am currently making a window application as a project and one of its requirements is to have a report in Excel format. I have search the web about this and have only seen method involving web based applications. Can someone help me? Thankss
|
|
|
|
|
Try this[^]
Good luck!
Aim small, miss small
|
|
|
|
|
I have a 100MB database of SQLServer. When I made a datagridview using DatagridViewColumnCombox in order that user can choose an item in combobox. When I choose an item, it seems to load data into combobox column. It cause my app running so slowly although this column contains a field about over 1000 records....
Somebody could help me explain why VS.NET uses cache but my app runs slowly
I assume that if I made a combo box and then attached it into datagridview, it ưould seem slower. But, I don't know how to do it....
Sorry about my poor English
Thanks in advance ...
It seem to be a solution or an answer.
|
|
|
|
|
phantanagu wrote: When I choose an item, it seems to load data into combobox column.
It *seems* to ? What code have you written, that you're not sure if it does, or not ?
If you take the SQL that's being run, and run it in SQL Server, how fast is it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: It *seems* to ? What code have you written, that you're not sure if it does, or not ?
I only assign datasource to combobox column using dataset object,I don't write any code. Because list of items appears slow so I think everytime I select an item in new row, combo box also loads data.
Christian Graus wrote: If you take the SQL that's being run, and run it in SQL Server, how fast is it ?
I am sure that if I run it in SQLServer, it makes me content with speed. If I use a favourite combox, loading of data is OK. But when using DatagridColumnComboBox, I confuse it...
It seem to be a solution or an answer.
|
|
|
|
|
Did you write code to load the data or you've drag/drooped in VS.NET a connection/dataset and so on?
http://stefanprodan.wordpress.com
|
|
|
|
|
I know i can add an IE web browser to a c# app using the Microsoft Web Browser Component, can i do the same to add a Firefox browser?
If not, how would i go about manipulation the Microsoft Web Browser to look like firefox? Ie.. by referencing the Mozilla standards?...
Thanks Heaps
|
|
|
|
|
Search for Mozilla ActiveX. That is an ActiveX component just like Internet Explorer, you can plop it on your form the same way.
|
|
|
|
|
Thanks heaps
|
|
|
|
|
Hello
How do i modify my C# form in such a way that every time I run it, it will automatically maximize and fit the screen?
thanks in advance
|
|
|
|
|
In the designer, the form has a WindowState property. Set it to Maximised.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|