post.
Essentially:
string s = "søme string";
s = Regex.Replace(s, @"[^\u0000-\u007F]", "");
I didn't want control characters so my filter was \u0020-\u007F.
Enjoy!
Ideas and thoughts about Microsoft Identity, C# development, cabbages and kings and random flotsam on the incoming tide
string s = "søme string";
s = Regex.Replace(s, @"[^\u0000-\u007F]", "");
# Set root category priority to INFO and set its only appender to A1
log4j.rootCategory=INFO, A1
# A1 is set to be a ConsoleAppender (writes to system console).
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
XDocument simpleDoc =
new XDocument(
new XElement("TopLevel",
new XElement("SecondLevel",
  new XElement("a", "b",
new XAttribute("class", "level"))
)
)
);
simpleDoc.Dump();
<TopLevel>
<SecondLevel>
<a class="level">b</a>
</SecondLevel>
</TopLevel>
string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
var getDigits =
from d in digits
where d[0] == 't'
select d;
getDigits.Dump();
string [] allEmployees1 = Employees.Select (e => e.LastName).Take(4).ToArray();
allEmployees1.Dump();
foreach (string s in allEmployees1)
Console.WriteLine(s);
// Per Eric White. The following is a query to split a string into words, only
// allow words > 1 character, eliminate the ones that contain the letter
// "y", convert the words to lower case, count the number of occurrences of
// each word, and return the ten most used words.
string text = "Debugging LINQ queries can be problematic. One of the reasons is that quite often, you write a large query " +
"as a single expression, and you can’t set a breakpoint mid-expression. Is LINQ really that problematic? " +
"Queries can be fun as is debugging!";
var uniqueWords = text
.Split(' ', '.', ',', '?', '!')
.Where (i => i != "")
.Where (i => i.Count() > 1)
.Where (i => !i.Contains ("y"))
.Select(i => i.ToLower())
.GroupBy(i => i)
.OrderByDescending(i => i.Count())
.Select(i => new { Word = i.Key, Count = i.Count() })
.Take(10);
uniqueWords.Dump();
var products = CompiledQuery.Compile ((TypedDataContext dc, decimal minUnitPrice) =>
from prod in Products
where prod.OrderDetails.Any (c => c.UnitPrice > minUnitPrice)
select prod
);
products (this, 20).Dump ("Unit price > $20");
var products1 =
from prod in Products
where prod.OrderDetails.Any (c => c.UnitPrice > 20)
select prod;
products1.Dump();
var products2 =
(from prod in Products
from od in OrderDetails
where od.UnitPrice > 20 && prod.ProductID == od.ProductID
select prod).Distinct();
products2.Dump();