QUESTIONS

Tagged: c#

answers  0
views  187
votes  0

[Question] Reading and writing Cookies in ASP.NET Core  

In ASP.NET Core the web.config file is gone. Instead we use project.json, which is fine. One of the things we used to do in web.config is configuring all cookies to be HttpOnly and -- in some cases -- ...
Apr 22, 2016
Chris Harris
{ 50 - 1 - 0 }
answers  0
views  139
votes  0

[Question] Calling Asynchronous method from a Synchronous method  

In our application we are forced to call an Asynchronous method from a Synchronous method. The reason is that we are using a 3rd party package that only provides async methods in certain cases. My u ...
Apr 21, 2016
Jibril Church
{ 50 - 1 - 0 }
answers  0
views  198
votes  0

[Question] Custom Taghelpers: Getting the Content or InnerHtml out of the current tag?  

I am creating a custom TagHelper. A simplified version looks like this: <display>Harry Potter</display> I can build a replacement tag and all its attributes, but how do I get the content out of th ...
Apr 21, 2016
Kevin Snyder
{ 85 - 1 - 0 }
answers  0
views  840
votes  0

[Article] Overriding the Equals() and GetHashCode() methods in C# - Part 2  

This is in continuation to Overriding the Equals() and GetHashCode() methods in C# - Part 1 System.Object.GetHashCode() virtual method This method returns a number for an object that assigned by the . ...
Apr 21, 2016
Gaime Sullivan
{ 900 - 171 - 0 }
answers  0
views  1K
votes  0

[Article] Overriding the Equals() and GetHashCode() methods in C# - Part 1  

System.Object.Equals() virtual method The Equals() is a virtual method defined in the System.Object class. Since every class is implicitly derived from Object, it provides the Equals() method. publi ...
Apr 21, 2016
Gaime Sullivan
{ 900 - 171 - 0 }
answers  0
views  181
votes  0

[Question] What is better: place the using directives inside a namespace or outside?  

Most C# developers place their using directives outside the namespace, i.e. at the top of the file just before the namespace declaration, like so: using System; using System.IO; namespace MyProjec ...
Apr 21, 2016
Neelambar Mitra
{ 50 - 1 - 0 }
answers  0
views  507
votes  0

[Question] Fastest way to serialize a POCO to JSON and deserialize JSON to a POCO  

What is the fastest way to serialized a POCO object to a JSON string and deserialize a JSON string back to a POCO object? I have seen several libraries and implementations, but what counts for us is s ...
Apr 13, 2016
Klaus Wörner
{ 50 - 1 - 0 }
answers  0
views  300
votes  0

[Snippet] Writing an exception to a txt file in C#  

For a small text project I wanted to write an exception to a reusable text file. Each new exception should override the prior one. So, the file should hold just the last exception at any point in time ...
Apr 08, 2016
Dimitrios Mihail
{ 60 - 1 - 0 }
answers  0
views  720
votes  3

[Question] How to pass a parameter to a SQL IN clause with C#, SQL Server  

My database has two tables that have master-child relationship. They are School and Student. Each school can have any number of students. A user has selected a number of schools. Next, they want to ...
Apr 07, 2016
Cheng Cao
{ 64 - 1 - 0 }
answers  0
views  357
votes  0

[Article] A gentle introduction to C# Attributes  

A software component is an independent, reusable, binary piece that can be used by other programs. Essentially, a software component should be self-describing i.e. all its related information should b ...
Apr 05, 2016
Devin Markku
{ 50 - 1 - 0 }
answers  0
views  349
votes  0

[Question] Going forward: Should I rewrite my HtmlHelpers into TagHelpers?  

We are considering migrating our MVC 4 solution over to ASP.NET Core. Should we rewrite all our HtmlHelpers over to TagHelpers or is that considered wasted effort. We certainly like the TagHelper s ...
Apr 04, 2016
Marlen Stas
{ 50 - 1 - 0 }
answers  0
views  405
votes  0

[Question] Creating nested TagHelpers in ASP.NET Core  

I am building a complex taghelper that can use functionality that is available in other taghelpers. Is there is way to do this? If so, is there is an example I can see?
Apr 04, 2016
Vipin Brar
{ 50 - 1 - 0 }
answers  0
views  31K
votes  4

[Snippet] How to Encrypt and Decrypt a string in C#  

Here is a code snippet to help you encrypt and decrypt a string in C#. The key is hardcoded, but in your own project you may want to read it from a secure store, or perhaps a config file or environmen ...
Apr 03, 2016
Sacchidananda Murthy
{ 57.1K - 5838 - 5 }
answers  0
views  354
votes  0

[Question] Dynamically combining multiple OrderBy clauses in LINQ  

Our application has a search screen in which users search a very large database with doctor and nurse records. They can specify: Search String Filters Sort Order Any combination is possible: somet ...
Apr 03, 2016
Tranter Cornell
{ 50 - 1 - 0 }
answers  0
views  307
votes  0

[Question] How can I prevent SQL-injection in ADO.NET?  

I am new to .NET and have started working on a .NET project with ADO.NET data access. How do I prevent SQL Injection in ADO.NET? I am using both VB.NET and C#. Any code examples would be helpful.
Apr 02, 2016
Bolek Otar
{ 75 - 2 - 0 }
18  posts
You may also like
When to use 'ref' and 'out' keywords - specifically with strings?
Visual Studio 2015 F10 Debugger key not working
Horizontally centering a <div> inside another <div>
How to Encrypt and Decrypt a string in C#
Server Side Rendering in JavaScript?
Curlybrackets Software
The source code for Curlybrackets (C#/.NET/SQL Server) is available for purchase here. Start your own Q+A site now!

Easily create custom post types: messages, ideas, questions, tickets, whatever.

The Software Pack is a great place to start your corporate Q+A customer support site.