Questions tagged [c#]
C# (pronounced "see sharp") is a high-level, statically typed, multi-paradigm programming language developed by Microsoft. C# code usually targets Microsoft's .NET ecosystem, which include .NET, .NET Framework, .NET MAUI, and Xamarin among others. Use this tag for questions about code written in C# or about C#'s formal specification.
1,620,084
questions
-8
votes
2
answers
208
views
repeat function every second
I want to add to my local database every second, real time data, the only method is timer, but , i don't know where i can declare the class , and how i can use it
remark : cn is the SQL connection
...
-8
votes
1
answer
150
views
C# Global Object [closed]
I am building a program for my course in which i need global objects as i intend to have the object accessible from many forms and edited also. Before saying just use global variables i cant the specs ...
-8
votes
1
answer
1k
views
find first 1500 natural numbers whose factors are either ONLY 2, 3, or 5
I have tried:
static void primeFactors(int n)
{
int t = 0;
List<int> lst = new List<int>();
for (int c = 2; c <= n; c = c + 1)
{...
-8
votes
1
answer
115
views
c# should i use string with regex matchs or not
I have a text that I am going to find matchs within that text and after that putting the results on array .
when I tried to make string array and string variables I found that it's really confusing ...
-8
votes
2
answers
2k
views
C# How to replace the first word in a string
string myfather = "Wow, no, Wow";
myfather = myfather.Replace("Wow", "");
//how to make the result ", no, Wow"
how to make the result ", no, Wow"
-8
votes
1
answer
56
views
Extracting certain data from a string?
Is there any way to extract an integer from a position in a string? Each string will have the word "documents" after it (e.g. "There are 22 documents").
-8
votes
2
answers
100
views
How to decrypt,encrypted data using Cryptography [closed]
Hello i'm trying to make a simple encrypt,decrypt algorithm and i maked encrypt code correctly,but description code not working
static string Encript(string value)
{
using (...
-8
votes
1
answer
75
views
How to parse date YYYYMMDDHHMMSSUTC [closed]
For example, parsing 20150828020000UTC? Haven't found anything resembling. DateTime.ParseExact doesn't seem to do the job.
-8
votes
1
answer
134
views
Convert a number to 1 decimal precision [duplicate]
I want to round off the given number to one decimal place but if the number is a whole number then output should have one zero after decimal.
Example:
Input:
24.66,
24.0002,
24.62
Output :
24.7,
...
-8
votes
1
answer
824
views
How to write foreach with "&&" condition
foreach (Panel panelControls in PlaceControls.Controls.OfType<Panel>())
{
foreach (Panel panelControls in PlaceHolder1.Controls.OfType<Panel>())
{
//...
-8
votes
2
answers
1k
views
Read, write, from and to a file using C#
Very simple and straight forward, I want to read from a file; convert the string value to an int, iterate using "for statement" and write the file into another file. When writing, it should write each ...
-8
votes
1
answer
2k
views
Sort list of strings alphabetically in .net
How to sort list of words alphabetically in dot net without using any built in functions like Sort.
If I have a list of words : Hello,Awesome,Cool,Stuff
output: Awesome,Cool,Hello,Stuff
I don't want ...
-8
votes
2
answers
69
views
Assign values to another position [closed]
Very simple question i have.But trouble on me.
I have below for loop. and i need to assign some values.
int i;
for (i = currPos + 1; i < expPos;i++ )
{
[i + 1] = i;// I want to assign i th ...
-8
votes
1
answer
91
views
trying to write a program to undersatnd pre & post increments and unary operators
using System;
namespace UnaryOperators
{
class UnaryOperators
{
//pre and post incerment checking and examples
public int a=0;
public int PreIncrement()
//...
-8
votes
1
answer
124
views
How can i sort two integer arrays parallel with quick sort in C#?
I want to sort two arrays simultaneously. I am beginner in Parallelizing in c# and i want to know how i should do it, by Multithreading or something like that...
a1 and a2 are integer
quick_sort(a1,0,...