c#-2.0

Is it possible to create read only elements in SOAP web services?

耗尽温柔 提交于 2020-02-02 08:41:08
问题 I have a class with a read-only property defined. In my code I define this as a property with a getter only. I want to be able to send this object back and forth across a web service. When I call a "Get" method in the service, it would be populated with a value on the service side. Once I define this property, I don't want the consumer of the web service to be able to set/change this property. When I add a reference to this web service to a project, the object has the property serialized a

Is it possible to create read only elements in SOAP web services?

∥☆過路亽.° 提交于 2020-02-02 08:40:48
问题 I have a class with a read-only property defined. In my code I define this as a property with a getter only. I want to be able to send this object back and forth across a web service. When I call a "Get" method in the service, it would be populated with a value on the service side. Once I define this property, I don't want the consumer of the web service to be able to set/change this property. When I add a reference to this web service to a project, the object has the property serialized a

how to delete a row in a gridview using delete button outside the grid?

笑着哭i 提交于 2020-01-25 11:25:27
问题 i have a grid in which there are various records. On my form i have a Update and Delete button outside the grid. there are different textbox. when i selected a row in a grid its value appear in these textbox from where i can update these value. thats work fine for me. Now i want to delete the selected row? i dont want to delete a record using delete button in the grid. i want when i select a row and press a delete button then the selected row should delete from grid as well from database. 回答1

How to create Header in PDF generation using C# iText7

随声附和 提交于 2020-01-25 06:56:10
问题 I tried to add Header in all the pages of my PDF using iText package in .NET C#, but it's not working. Note: I'm using iText version 7 I tried the following Stack Overflow answers, they demonstrated only for Footer (i.e., END_PAGE ) not for START_PAGE Add Header and Footer for PDF using iTextsharp My Code : class Program { static void Main(string[] args) { var writer = new PdfWriter("E:/pdfSample/bala.pdf"); var pdf = new PdfDocument(writer); var document = new Document(pdf,PageSize.A4);

Migrating from SSLv3 to TLSv1

和自甴很熟 提交于 2020-01-24 15:15:22
问题 With regards to POODLE, SSLv3 is now disabled on the Server. The client software was developed in .NET 2.0 and provides TLSv1 as the only alternative. I have access and ability to make changes to both the client application and server configuration. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; is used to force all HttpWebRequest.GetResponse() calls to use TLSv1. And SslStream.AuthenicateAsClient() is used with the argument SslProtocols.Tls to force TLSv1 to be used during

Migrating from SSLv3 to TLSv1

。_饼干妹妹 提交于 2020-01-24 15:14:21
问题 With regards to POODLE, SSLv3 is now disabled on the Server. The client software was developed in .NET 2.0 and provides TLSv1 as the only alternative. I have access and ability to make changes to both the client application and server configuration. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; is used to force all HttpWebRequest.GetResponse() calls to use TLSv1. And SslStream.AuthenicateAsClient() is used with the argument SslProtocols.Tls to force TLSv1 to be used during

Get icon 128*128 File type C#

情到浓时终转凉″ 提交于 2020-01-23 04:03:42
问题 I need to get the icon of a file type doc or txt It's size should be 128*128 and be saved as an png or ico file in good quality. I used Icon ico = Icon.ExtractAssociatedIcon(@"d:\\1.txt"); pictureBox1.Image = ico.ToBitmap(); and save the image from the pictureBox1, but that size is 32*32. I really want a size 128*128. How can I do that? 回答1: There is no icon-size 128x128 available from the Shell API SHGetImageList. The sizes range from the Win95 era of 16x16 and 32x32 via XP's 48x48 and

Forwarding events in C#

霸气de小男生 提交于 2020-01-19 06:52:11
问题 I'm using a class that forwards events in C#. I was wondering if there's a way of doing it that requires less code overhead. Here's an example of what I have so far. class A { public event EventType EventA; } class B { A m_A = new A(); public event EventType EventB; public B() { m_A.EventA += OnEventA; } public void OnEventA() { if( EventB ) { EventB(); } } } Class A raises the original event. Class B forwards it as EventB (which is essentially the same event). Class A is hidden from other

SNIReadSync executing between 120-500 ms for a simple query. What do I look for?

醉酒当歌 提交于 2020-01-15 06:20:08
问题 I am executing a simple query against SQL Server 2005: protected static void InitConnection(IDbCommand cmd) { cmd.CommandText = "set transaction isolation level read uncommitted "; cmd.ExecuteNonQuery(); } Whenever I profile with dotTrace 3.1, it claims that SNIReadSync method is taking between 100 - 500 ms. What sort of things do I need to be looking for in order to get this time down? Thanks! 回答1: I have not tested, but would wonder if you have the same issue if you used a TransactionScope

How to select current dates from current month

非 Y 不嫁゛ 提交于 2020-01-15 03:32:06
问题 I would like to retrieve the data between 1 -30 of the current month [ i am using MSACCESS Dbase to do so] Below is the query that i am trying -- SELECT count(usercategory) as category_count ,usercategory FROM user_category where IssueDate between DATEADD('m', DATEDIFF('m', 0, DATE()) - 0 , 0) and DATEADD('m', DATEDIFF('m', 0, DATE()) + 1, - 1 ) group by usercategory Data that i am holding in my MSACCESS Dbase - Category1 9/7/2013 12:00:00 AM Category1 9/8/2013 12:00:00 AM Category2 10/8/2013