|
See c - Google Search[^]. You should also check with the manufacture to see if they have an SDK of their own.
|
|
|
|
|
What are Good Things to Know in a C# Interview?
Off the top of my head, I have come up with this list:
* SOLID mythodology.
* Dependency Injection
* Levels of Try, Catch, throw, and finally statements and how they work
* The tenants of Object Oriented Programming such as polymorphism, enacpsulation, etc.
* Unit Testing (are interfaces used somehow)
* The difference between an abstract class and interface
* garbage collection and when to override or overload it
* difference between override or overload
* Is there inheritance in C# ?
* What is an interface used for?
I am posting this here to see of anyone can add to this list. I am asking about general topics, not specific interview questions.
|
|
|
|
|
"Why did you bother to learn 'interview question and answer' stuff, since the follow up question will just show you don't know anything in any detail?"
Forget them: know your subject and apply for jobs you can do instead of ones you can't ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
A completely useless endeavor as there are thousands of possible interview questions and you can't memorize it all.
Part of the interview process is how you handle (and answer) questions you don't know the answer to.
|
|
|
|
|
This. I have a couple of topics (IDisposable and async). I do warn up front that my goal is to see how they reason about things they do not know for sure, so they should expect I ask them things they do not know. I give this warning as the goal is not to test how they deal with panic, but how they reason. While it can be nice to test how people deal with panic, it is luckily not something we need resilience against on a daily basis - so reasoning is more important.
The nice things about these topics is they are simple on the surface but quite complicated once you dig into them. So the topics works for juniors as well as people with a lot of experience.
|
|
|
|
|
Thanks anyway
|
|
|
|
|
If you can't answer, you liable in the Nerherlands.
I know, I caused damage north of 14k Euro, including overtime.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
CS5001 Program does not contain a static 'Main' method suitable for an entry point RegistrationForm1 C
I am getting this msg
while validating form in window form application
|
|
|
|
|
Every EXE file needs an entry point: this is the static Main method which either contains the application code (for a console app) or runs the actual Application by creating an instance of the main form (for a Windows GUI app).
For GUI apps you will normally find it it the program.cs file, which is created for you when you create a new Project.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Iam trying to send a mail using google.Apis.Gmail.v1 and MimeKit, but the issue is that when I use Arabic characters, the receiver receives gibberish text.
My code is below:
var mail = new MimeMessage();
mail.From.Add(new MailboxAddress("From Name", "DoNotReply@someDomain.com"));
mail.To.Add(new MailboxAddress("To Name","customerAddress@someDomain.com"));
mail.Subject = "كشف حساب من تاريخ " + dateTimePicker1.Text + " حتى تاريخ " + dateTimePicker2.Text;
var text_part = new TextPart(MimeKit.Text.TextFormat.Plain);
string body = @"<table border='1'><table style='background-color:#E5E4E2;'><tr><tr style='background-color:#1e90ff;color:#ffffff;'><td>تراكمي</td><td>دائن</td><td>مدين</td><td>البيان</td><td>المرجع</td><td>التاريخ</td></tr>";
foreach (ListViewItem lstitem in listView1.Items)
{
body += @"<tr><td>" + lstitem.SubItems[1].Text + "</td><td>" + lstitem.SubItems[2].Text + "</td><td>" + lstitem.SubItems[3].Text + "</td><td>" + lstitem.SubItems[4].Text + "</td><td>" + lstitem.SubItems[5].Text + "</td><td>" + lstitem.SubItems[6].Text + "</td></tr>";
}
body += @"</table></style></style>";
body += @"<br /><br /> المبلغ المطلوب " + sum1s.Text;
body += @"<br /><br /> Thank You";
mail.Body = new TextPart("html") { Text = body };
byte[] bytes = Encoding.UTF8.GetBytes(mail.ToString());
string raw_message = Convert.ToBase64String(bytes)
.Replace('+', '-')
.Replace('/', '_')
.Replace("=", "");
UserCredential credential;
using (FileStream stream = new FileStream(Application.StartupPath + @"/credentials.json", FileMode.Open, FileAccess.Read))
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
path = Path.Combine(path, ".credentials/gmail-dotnet-quickstart.json");
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, Program.Scopes, "user", CancellationToken.None, new FileDataStore(path, true)).Result;
}
var service = new GmailService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = Program.ApplicationName });
var msg = new Google.Apis.Gmail.v1.Data.Message();
msg.Raw = raw_message;
service.Users.Messages.Send(msg, "me").Execute();
MessageBox.Show("تم ارسال التقرير بنجاح", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
And what I receive is:
تراكمي دائن مدين البيان المرجع التاريخ
985.00 58228.00 57243.00 رصيد منقول - 01/03/2022 00:00:00 AM
985 58228 -57243 المجموع الكلي - 11/03/2022 09:49:42 AM
المبلغ المطلوب + 985 شيكل
Thank You
|
|
|
|
|
Hi,
I don't think this is a C# language issue, but rather RFC 3282[^]
This is not really my area of expertise but I think you just need to add a "Content-language:" header.
|
|
|
|
|
Hi Folks,
i have created a simple page which adds textbox dynamically. 1st textbox creates successfully but afterwards it showes error of object reference not set to an instance of an object.
it is not getting the ID of the panel which i contains the textbox.
my aspx file is....
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Header.Master" CodeFile="testpage.aspx.cs"
Inherits="testpage" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:content id="HeaderContent" runat="server" contentplaceholderid="head">
<asp:content id="BodyContent" runat="server" contentplaceholderid="ContentPlaceHolder1">
<asp:panel id="pnlTextBoxes" runat="server">
<asp:button id="btnAdd" runat="server" text="Add New" onclick="AddTextBox">
<asp:button id="btnGet" runat="server" text="Get Values" onclick="GetTextBoxValues">
and .cs file is....
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class testpage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Page_PreInit(object sender, EventArgs e)
{
List<string> keys = Request.Form.AllKeys.Where(key => key.Contains("txtDynamic")).ToList();
int i = 1;
foreach (string key in keys)
{
this.CreateTextBox("txtDynamic" + i);
i++;
}
}
protected void AddTextBox(object sender, EventArgs e)
{
int index = pnlTextBoxes.Controls.OfType<TextBox>().ToList().Count + 1;
this.CreateTextBox("txtDynamic" + index);
}
private void CreateTextBox(string id)
{
TextBox txt = new TextBox();
txt.ID = id;
pnlTextBoxes.Controls.Add(txt);
Literal lt = new Literal();
lt.Text = "<br />";
pnlTextBoxes.Controls.Add(lt);
}
protected void GetTextBoxValues(object sender, EventArgs e)
{
string message = "";
foreach (TextBox textBox in pnlTextBoxes.Controls.OfType<TextBox>())
{
message += textBox.ID + ": " + textBox.Text + "\\n";
}
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('" + message + "');", true);
}
}
|
|
|
|
|
Which line causes the error?
|
|
|
|
|
In createtextbox function
>pnlTextboxs.contros. Add(txt);
|
|
|
|
|
There is nothing obvious that I can see in the code. As @OriginalGriff says below, you will need to do some debugging to find out what is happening.
|
|
|
|
|
I have debugged it and found the problem is with content panel. Please help I am sinking with it.
|
|
|
|
|
OK, and what exactly is the problem?
|
|
|
|
|
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself.
Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it contains null - which means that there is no instance of a class in the variable.
It's a bit like a pocket: you have a pocket in your shirt, which you use to hold a pen. If you reach into the pocket and find there isn't a pen there, you can't sign your name on a piece of paper - and you will get very funny looks if you try! The empty pocket is giving you a null value (no pen here!) so you can't do anything that you would normally do once you retrieved your pen. Why is it empty? That's the question - it may be that you forgot to pick up your pen when you left the house this morning, or possibly you left the pen in the pocket of yesterday's shirt when you took it off last night.
We can't tell, because we weren't there, and even more importantly, we can't even see your shirt, much less what is in the pocket!
Back to computers, and you have done the same thing, somehow - and we can't see your code, much less run it and find out what contains null when it shouldn't.
But you can - and Visual Studio will help you here. Run your program in the debugger and when it fails, it will show you the line it found the problem on. You can then start looking at the various parts of it to see what value is null and start looking back through your code to find out why. So put a breakpoint at the beginning of the method containing the error line, and run your program from the start again. This time, the debugger will stop before the error, and let you examine what is going on by stepping through the code looking at your values.
But we can't do that - we don't have your code, we don't know how to use it if we did have it, we don't have your data. So try it - and see how much information you can find out!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thank you for your detailed reply.
But I did have debugged the code and it breaks at pnlTextbox.Controls.add(txt); under createtextbox function. What I assume is the problem is occurring with the panel ID (pnlTextbox) which contains textbox. The same code when I run without content panel it runs (like if remove content panel and use form1 and body).
|
|
|
|
|
If you use the debug they you either know it is the pnlTextbox that is null, it's Controls collection that is null, or the txt is null.
So take that knowledge back to the debugger, and look at where those values are set - i.e. where they become null - to start looking at why.
Debuggers don't fix code, they let you gather information on why it's wrong, and that lets you fix it.
Saying "this is null" is a symptom, not the disease - and you don't treat symptoms when the disease is what's killing you!
And we can't do that for you - we just don't have any way to run your code under the same circumstances!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Solved the issue finally 😅.
Actually the problem was with page_preint event... My master page file contains a content place holder and preint event was generating the Panel ID with ContentPlaceholder1_pnlTextboxes. Issue resolved by shifting the code from preint to page load event. Thanks everyone
|
|
|
|
|
Nine posts to this thread and yet not a single error code as diagnostic.
|
|
|
|
|
You don't get error codes for "object reference not set to an instance of an object".
|
|
|
|
|
Well ... ok, TECHNICALLY you're right. But in defense of ram and cram coders like myself around the world: service visible[^]
"NullReferenceException" would have been more descriptive; if not because it contains quotation marks around the offending sovereign then because any one of us could have responded by dropping a dime on IT using the help documentation of VS thus verifying he had eyeballs in his head.
CP is not a classless society, as Shep surely is aware. 
|
|
|
|
|
Update: revised code to use full Type names, not var; used hard-coded filepath.
Now, in VS 2019 using FW 4.8, File.Create terminates the app with no error message. I tried wrapping the call in a Try/Catch: terminates the app without ever reaching the Catch clause.
Note: i can't find any error reports on the behavior of File,Create described here.
A few years ago, the code shown here was a standard part of the serialization library i wrote, and worked fine. The other part of the library, which uses XML serialization, works without errors.
Note: the code shown compiles, but, fails in the first 'using block. File,Create moved outside the using statement also fails the same way. So, there's nothing specifically GZippy where the code fails.
// reqiured usings
using System.IO;
using System.IO.Compression;
using System.Runtime.Serialization;
public static void GZSerialize<T>(T instance, string baseFolderPath, string filename1)
{
dcs = new DataContractSerializer(typeof(T));
string fullfilename = baseFolderPath + "/" + filename1 + (usegzip + @".gz";
string fullfilename = @"C:\Users\Win-Ten\Desktop\fordata\test4.gz";
using (FileStream compressedFileStream = new FileStream(fullfilename, FileMode.OpenOrCreate, FileAccess.Write))
{
using (GZipStream compressionStream =
new GZipStream(compressedFileStream, CompressionLevel.Optimal, true))
{
dcs.WriteObject(compressionStream, instance);
compressionStream.Close();
}
}
}
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
modified 8-Mar-22 16:14pm.
|
|
|
|
|