Showing posts with label Csharp. Show all posts
Showing posts with label Csharp. Show all posts
Tuesday, 16 April 2013

Asp.Net: Bypass local proxy

Question:
How to bypass a local proxy when doing HttpWebRequests in dot.net?

Friday, 5 April 2013

CSharp: setting private field reflection

Question:
How can I set the StackTrace property of an exception in c#?
Can I set a private field of an object in dot.net?

Tuesday, 2 April 2013

Silverlight: get children of a control

Question:
How to get in Silverlight all children of a given control?
Get all children of a given type from a control in Silverlight 4?

Wednesday, 14 November 2012

CSharp: Read bytes from File

Question:
How to read bytes from a file?
How to read a file as a byte array?

Monday, 17 September 2012

CSharp: Slice in CSharp

Question:
Is there an equivalent to the Python slice method in c#?
How to slice in c#?

Tuesday, 19 June 2012

CSharp: How to replace with Regex

Question:
How to replace a set of chars by another character using regular expressions in C#?

Monday, 23 April 2012

Dot.Net: Method name Reflection

Question:
How to get the method name of the method you are executing?
I want to log the method name of my context method; how do I do that?

Tuesday, 6 March 2012

Dot.Net: Get Dot.Net Source Code

Question:
Is there a way to see the source code of the dot.net framework?

Monday, 26 September 2011

Asp.Net: Embed image in server control's assembly.

Question:
How to embed an image file  as an embedded resource in a server control assembly?
How to access an image from a server control assembly?

Asp.Net: Embed CSS in server control's assembly.

Question:
How to embed a CSS file in a server control assembly?
How to access style information (CSS) from a server control assembly?

Thursday, 22 September 2011

Dot.Net: How to write RSS date format in CSharp

Question:
In a RSS feed I need to write dates in the format RFC #822. How do I do this?
How to write a string in the RFC 1123 format??

Wednesday, 14 September 2011

Dot.Net: Generic List - test Subclass of IEnumerable

Question:
How to test if a given generic list type (e.g. List<>) implements an interface (e.g. IEnumerable<> or IEnumerable)?
How to check interface implementation for generic types? (IsSubclassOf does not work)

Tuesday, 23 August 2011

Asp.Net: Generate PDF from Web Page

Question:
How to convert Html to PDF for a web page with wkhtmltopdf in asp.net ?
How to generate PDF from HTML using wkhtmltopdf in .net?

Asp.Net: Write Binary Stream to Response

Question:
How to send a Pdf binary stream as response of a web request?
How to return a generated pdf to the user in an asp.net app?

Friday, 19 August 2011

Csharp: Regular Expressions Named Captures

Question:
How to use Named Capture Groups with C# Regular Expression class (Regex)?

Tuesday, 16 August 2011

VisualStudio: Cheat Sheet CSharp Code Snippets


Question:
What are the common c# code snippets in Visual Studio 2010.

Monday, 18 July 2011

Dot.Net: Register WebResource Javascript from Different Assembly

Question:
I have a web control project and a web project.
In the web control project I embed a javascript file and declared it as a WebResource in the AssemblyInfo.cs:
[assembly: System.Web.UI.WebResource("Namespace.Folder.MyScript.js", "text/javascript", PerformSubstitution = false)].

When I want to use it from the web project using:
this.Page.ClientScript.RegisterClientScriptResource(this.GetType(), "Namespace.Folder.MyScript.js");
It does not work.
Why is the javascript file not loaded into the page?

Dot.Net: Loading UserControl ascx Dynamically

Question:
How to load a UserControl (ascx) dynamically?

Dot.Net: Make Internal Methods and Properties visible to another DLL

Question:
How to make internals visible to another dll?
I want to render my internals visible to a test class. How do I do that?

Friday, 20 May 2011

Asp.Net: Using Templated Controls Programmatically

Question:
How to add templates programmatically to a templated control?
How to programmatically set templates, events, databinding on a repeater in asp.net?