37 Answered Questions for the topic C#

C#

10/18/19

TypeScript saving a file to a server

I am altering an existing API that uses TypeScript. I need to have the API save a file to an external server. Is there a way to do this without having a Save File window show up in TypeScript? ... more
C#

09/28/19

C# Interactive GUI Form Help

Write a GUI program named EggsInteractiveGUI that allows a user to input the number of eggs produced in a month by each of five chickens. Sum the eggs, then display the total in dozens and eggs.... more
C#

08/04/19

Report Viewer limitation?

I have a ReportViewer(C#, asp.net 4.5). My query returns over 700'000 rows of data but it takes forever for the report viewer to show(it does not show, I think report viewer rendering is... more
C#

08/03/19

Finding the coordinates on the edge of a circle?

Using C#: How do I get the (x, y) coordinates on the edge of a circle for any given degree, if I have the center coordinates and the radius? There is probably SIN, TAN, COSIN and other grade ten... more
C#

07/30/19

const correctness in C#?

The point of const-correctness is to be able to provide a view of an instance that can't be altered or deleted by the user. The compiler supports this by pointing out when you break constness from... more
C#

07/27/19

Check if a point is in a rotated rectangle (C#)?

I have a program in C# (Windows Forms) which draws some rectangles on a picturebox. They can be drawn at an angle too (rotated). I know each of the rectangles' start point (upper-left corner),... more
C#

07/19/19

Partially Overriding a Virtual Auto-Property in a Child Class?

Time for a theoretical question I just ran across.The following code is valid and compiles: public class Parent { public virtual object TestProperty { get; set; } } public class... more
C#

07/19/19

Get file to send as attachment from byte array?

I have an ASP.NET MVC application that has to send an email to a list of recipients with an attachment detailing a specific "Project". I get the details for this from a report by making use of SQL... more
C#

07/16/19

C# class within a class (or nesting)?

Hey all I have made the following class: public class ssrsFormats { public static readonly string pdf = "PDF", mhtml = "MHTML", html4 = "HTML4.0", html3 = "HTML3.2", ... more
C#

07/15/19

Arrays in c# programming/passing by reference

Create two static methods, one called changePrices and one called printit. When the changePrices method is called from Main you should pass the item_price array by reference, the price point and... more
C#

07/14/19

What is Entity Framework in MVC?

C#

07/13/19

Does the ``??`` operator use shortcircuiting?

Does the `??` operator in C# use shortcircuiting when evaluating? var result = myObject ?? ExpressionWithSideEffects(); When ``myObject`` is non-null, the result of... more
C#

07/13/19

Most succinct way to determine if a variable equals a value from a 'list' of values?

If I have a variable in C# that needs to be checked to determine if it is equal to one of a set of variables, what is the best way to do this? I'm not looking for a solution that stores the set in... more
C#

07/11/19

How to know if a line intersects a plane in C#?

I have two points (a line segment) and a rectangle. I would like to know how to calculate if the line segment intersects the rectangle.
C#

07/09/19

UInt64 and "The operation overflows at compile time in checked mode" - CS0220?

This feels like a stupid question, but I can't seem to see the answer. I have an UInt64, which is supposed to have a max value of UInt64.MaxValue 18446744073709551615 However, when I try to... more
C#

07/05/19

C# logic order and compiler behavior?

In C#, (and feel free to answer for other languages), what order does the runtime evaluate a logic statement? Example: DataTable myDt = new DataTable(); if (myDt != null &&... more
C#

07/03/19

How and when to abandon the use of arrays in C#?

Should you try to avoid using an array as much as possible when you will be adding a lot of elements? Should you use iStringMap instead? If so, what happens if you need more than two dimensions AND... more
C#

06/27/19

C# convert a string for use in a logical condition?

Is it possible to convert a string to an operator for use in a logical condition. For example if(x Convert.ToOperator(">") y) {} or if(x ">" as Operator y){} I appreciate that this... more
C#

06/22/19

Check severeal boolean returns in same time?

I have several bool elements and I am checking it if returns me false. bool i = false; switch (idcount) { case 1: i = p1(); break; case 2: i = p1() & p2(); break; case 3: i = p1() &... more
C#

06/22/19

Check severeal boolean returns in same time?

I have several bool elements and I am checking it if returns me false. bool i = false; switch (idcount) { case 1: i = p1(); break; case 2: i = p1() & p2(); break; case 3: i = p1() &... more
C#

06/19/19

Display 1,2,3,4,5,6,8,10,11 as 1-6,8,10-11?

> I have this sequence **1,2,3,4,5,6,8,10,11** > > Expected output is **1-6,8,10-11** This problem is about formatting the sequence in easy readable form I tried with c# and used many... more
C#

06/16/19

Generate class from database table?

How can i generate a class from a table at a SQL Server? I'm not talking about using some ORM. I just need to create the entities (simple class). Something like: public class Person { ... more
C#

06/15/19

c# - how to move point a given distance d (and get a new coordinates)?

I was wondering if there is any efficent way to calculating coordinates of point (which was moved distance d from it's original location). Let's say I have a point P(0.3,0.5) and I need to move... more
C#

05/27/19

Visual Studio Simulink connection?

Is it possible to connect Visual Studio code (say C#) with Simulink model in order to dynamically change input to the model. I have done some googling but no results. I'd apprecite any links or... more
C#

05/22/19

How to tell whether a point is to the right or left side of a line?

I have a set of points. I want to separate them into 2 distinct sets. To do this, I choose two points (*a* and *b*) and draw an imaginary line between them. Now I want to have all points that are... more
1

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.