Tagged Questions
0
votes
1answer
17 views
Finding and Filtering XML Data
I have an XML document here:
<?xml version="1.0" encoding="utf-8" ?>
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
...
4
votes
2answers
195 views
What is 'this' used for in C# language?
I've read open source c# code and there is a lot of strange grammar (to me).
They declare method arguments with the this keyword like this:
this object @object
What does it mean?
If I remove ...
2
votes
5answers
130 views
If / else statements in C#
Why does this work?
private void button1_Click(object sender, EventArgs e)
{
if (!checkBox1.Checked)
{
MessageBox.Show("The box is not checked!");
}
...
0
votes
3answers
54 views
How to do LINQ Cross Join With Dot Notation
I know how to write a query notation join in dot notation, but how do you write a cross join in dot notation?
List<Alpha> als = new List<Alpha>{new Alpha(), new Alpha()};
...
2
votes
1answer
73 views
In C#, why you can set a property to its self [duplicate]
Accidentally I created a bug in my work. The cause of the bug is a snippet of c# code like
public ClassA{
public string AProperty
{
get
{
...
2
votes
6answers
107 views
Shortest way of writing a C# property? [duplicate]
Someone told me that you could replace the following code:
private string name;
public string Name
{
get;
set;
}
with the following and suffer no ill effects:
public string Name;
I ...
1
vote
2answers
39 views
Sql inner join a select syntax to lambdas .join() syntax
I got this query :
select t.user
, t.loginDate
from t_login as t
inner join
(
select user, max(loginDate) as mostRecentLoginDate
from t_login
group by user
) as tt
on t.user ...
-8
votes
1answer
71 views
i keep getting syntax errors c#
I'm doing a music database program and i have added buttons to update the database through the program. eg: edit / new track / delete. but it keeps dragging up syntax errors making the updates only ...
5
votes
1answer
66 views
What does “~” mean before enums
Today I see this code:
ViewBag.country = from p in CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures)
select new SelectListItem
...
1
vote
3answers
68 views
Idiomatic way to test for Generic Type in C#
If I can test for basic class types like this in C#:
bool stringTest = new string() is string;
// and
bool listOfStringTest = new List<string>() is List<string>;
How do I test for List ...
0
votes
2answers
97 views
Can someone explain this syntax in C#?
When creating objects in Java I'm used to the following syntax:
objectX1 = new ObjectX(some arguments);
While looking over a project in C# I came across the following code:
_createSample = new ...
-3
votes
2answers
85 views
How to sort a list by a specific property in .NET 2.0? [duplicate]
In .NET 4.0 you can simply use LINQ to quickly sort a list by a specific property:
List<Point> list = ...;
sorted = list.OrderBy(p => p.X).ToList(); // sort list of points by X
Can ...
1
vote
1answer
97 views
What do greater/less than sign (e.g. Action<List<X>>) mean in C#?
example:
public event Action<List<WKSProfile>> WorkstationProfileChanged;
I have trouble understanding the the above member.
Does it imply that it returns :
...
1
vote
4answers
80 views
A lot of fields with the same attribute
I find myself writing a lot of this kind of stuff:
[SameAttribute]
ClassA fieldA;
[SameAttribute]
ClassB fieldB;
[SameAttribute]
ClassC fieldC;
...
Is there a syntax in C# that would allow me to ...
-3
votes
4answers
59 views
Syntax error in query [closed]
I get a OleDbException based on a Syntax error and I am struggling to pinpoint what the syntax error is.
This is the query:
foreach (var kvp in dictSeriesProds) {
s.SeriesName = ...